private void waitForConnection() throws IOException {
    addThreadToInterrupt();
    try {
      setStatus(ConnectionStatus.WAITING_FOR_CONNECTION, null);
      LOG.debug("waiting for connection on port " + getPort());

      try (Socket socket = myServerSocket.accept()) {
        attachToSocket(socket);
      }
    }
    finally {
      myServerSocket.close();
      removeThreadToInterrupt();
    }
  }
private void waitForConnection()