List of usage examples for org.apache.commons.net.ssh SSHClient getRemotePortForwarder
public RemotePortForwarder getRemotePortForwarder()
From source file:examples.ssh.RemotePF.java
public static void main(String... args) throws Exception { SSHClient client = new SSHClient(); client.loadKnownHosts();/*from ww w . j av a2 s . c o m*/ client.connect("localhost"); try { client.authPublickey(System.getProperty("user.name")); /* * We make _server_ listen on port 8080, which forwards all connections to us as a channel, and we further * forward all such channels to google.com:80 */ client.getRemotePortForwarder().bind(new Forward(8080), // new SocketForwardingConnectListener(new InetSocketAddress("google.com", 80))); // Something to hang on to so forwarding stays client.getTransport().join(); } finally { client.disconnect(); } }