/** * Start listening for incoming connections and forward to remote host as a channel. * * @throws IOException */ public void listen() throws IOException { log.info("Listening on {}", serverSocket.getLocalSocketAddress()); while (!Thread.currentThread().isInterrupted()) { final Socket socket = serverSocket.accept(); log.debug("Got connection from {}", socket.getRemoteSocketAddress()); openChannel(socket).start(); } log.debug("Interrupted!"); }