LocalStreamForwarder(ChannelManager cm, String host_to_connect, int port_to_connect) throws IOException { this.cm = cm; this.host_to_connect = host_to_connect; this.port_to_connect = port_to_connect; cn = cm.openDirectTCPIPChannel(host_to_connect, port_to_connect, "127.0.0.1", 0); }
/** * Close the underlying SSH forwarding channel and free up resources. You can also use this method * to force the shutdown of the underlying forwarding channel. Pending output (OutputStream not * flushed) will NOT be sent. Pending input (InputStream) can still be read. If the shutdown * operation is already in progress (initiated from either side), then this call is a no-op. * * @throws IOException */ public void close() throws IOException { cm.closeChannel(cn, "Closed due to user request.", true); }