try (Socket socket = new Socket("localhost", connector.getLocalPort());)
{
socket.setSoTimeout((int)connector.getIdleTimeout());
Assert.assertTrue(openLatch.await(5, TimeUnit.SECONDS));
socket.shutdownOutput();
Assert.assertTrue(closeLatch.await(5, TimeUnit.SECONDS));
String response=IO.toString(socket.getInputStream());
Assert.assertEquals(0,response.length());
// Wait some time to see if the callbacks are called too many times