Well, being closeted curious myself, I don't know if [what you said] would apply, simply because they don't know I would be interested.
Flirting is an innocent way of expressing interest in someone. Men generally say something they'd normally be afraid to say as a joke as a way to "test the waters", as you said; If it winds up upsetting someone, they can say "I was just kidding!".
I'm not saying that they want to fuck another guy, but I think that the vast majority of people have at least an innate curiosity that they suppress for fear of getting in trouble, basically. Joking, flirting and asking questions with a gay guy can be enough to satisfy their curiosity on its own, without going further.