Fixed unit tests broken by previous check in.
Fixed race: socket closed before it's created.