public int start() throws IOException {
		synchronized (this.monitor) {
			Assert.state(this.serverThread == null, "Server already started");
			ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
			serverSocketChannel.socket().bind(new InetSocketAddress(this.listenPort));
			int port = serverSocketChannel.socket().getLocalPort();
			logger.trace("Listening for TCP traffic to tunnel on port " + port);
			this.serverThread = new ServerThread(serverSocketChannel);
			this.serverThread.start();
			return port;
		}
	}
public int start ( ) throws IOException { synchronized ( this . monitor ) { Assert . state ( this . serverThread == null , "Server already started" ) ; ServerSocketChannel serverSocketChannel = ServerSocketChannel . open ( ) ; serverSocketChannel . socket ( ) . bind ( new InetSocketAddress ( this . listenPort ) ) ; int port = serverSocketChannel . socket ( ) . getLocalPort ( ) ; logger . trace ( "Listening for TCP traffic to tunnel on port " + port ) ; this . serverThread = new ServerThread ( serverSocketChannel ) ; this . serverThread . start ( ) ; return port ; } }
Start the client and accept incoming connections.
@return the port on which the client is listening
@throws IOException in case of I/O errors