public Socket awaitConnection() throws InterruptedException {
    return awaitConnection(Long.MAX_VALUE);
  }
@Test
  public void testConnectionFails() throws Exception {
    serverSocket.close();
    Thread thread = new Thread();
    thread.start();
    Socket socket = connector.awaitConnection(2 * DELAY);
    assertNull(socket);
    Exception lastException = exceptionHandler.awaitConnectionFailed(DELAY);
    assertTrue(lastException instanceof ConnectException);
    assertTrue(thread.isAlive());
    thread.interrupt();
    thread.join(4 * DELAY);
    assertFalse(thread.isAlive());
  }