code: public void bindAndStart(int port) throws Exception {
          server = new NioServer(new StreamConnectionFactory() {
              @Override
              public ProtobufConnection<Protos.TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) {
                  return new ServerHandler(new InetSocketAddress(inetAddress, port), timeoutSeconds).socketProtobufHandler;
              }
          }, new InetSocketAddress(port));
          server.startAsync();
          server.awaitRunning();
      }
docs: Binds to the given port and starts accepting new client connections.
  @throws Exception If binding to the given port fails (eg SocketException: Permission denied for privileged ports)