@Test(timeout = 10000)
public void testIdle() throws InterruptedException, IOException {

  Socket s = new Socket();
  try {
    s.connect(pm.getTcpServerLocalAddress());
    int i = 0;
    while (!s.isConnected() && i < RETRY_TIMES) {
      ++i;
      Thread.sleep(SHORT_TIMEOUT_MILLISECONDS);
    }
    Assert.assertTrue("Failed to connect to the server", s.isConnected()
        && i < RETRY_TIMES);
    int b = s.getInputStream().read();
    Assert.assertTrue("The server failed to disconnect", b == -1);
  } finally {
    s.close();
  }
}