code: public void connect() throws Exception {
  
  		// Create selector
  		disconnect();
  
  		// Open channel
  		serverChannel = ServerSocketChannel.open();
  		ServerSocket serverSocket = serverChannel.socket();
  		serverSocket.bind(new InetSocketAddress(transporter.getPort()));
  		serverChannel.configureBlocking(false);
  		selector = Selector.open();
  		serverChannel.register(selector, SelectionKey.OP_ACCEPT);
  
  		// Get current port
  		InetSocketAddress address = (InetSocketAddress) serverChannel.getLocalAddress();
  		currentPort = address.getPort();
  
  		// Get properties
  		maxPacketSize = transporter.getMaxPacketSize();
  
  		// Start selector
  		executor = Executors.newSingleThreadExecutor();
  		executor.execute(this);
  	}
docs: --- CONNECT ---