public int start() throws IOException {
    myServerSocket = new ServerSocket(0);
    int port = myServerSocket.getLocalPort();

    ApplicationManager.getApplication().executeOnPooledThread(() -> {
      try {
        boolean _continue = true;
        while (_continue) {
          try (Socket socket = myServerSocket.accept()) {
            _continue = myProtocol.handleConnection(socket);
          }
        }
      }
      catch (SocketException e) {
        //socket was closed, that's OK
      }
      catch (IOException e) {
        throw new RuntimeException(e); //TODO implement catch clause
      }
    });

    return port;
  }
public int start()