kafka-1574; unit tests can hang on socketserver shutdown; patched by Jun Rao; reviewed by Jay Kreps and Guozhang Wang