move @replies and @expected out of thread block
shorten delay between checks
do not flush the socket (does not seem to make any difference)
HACK: send spaces over socket while waiting for a response

I don't know what's going on here, but writing to the socket magically makes it appear
readable sooner.  Without this line the listener won't realise that the socket can
be read from until the next write.