/** * Starts a local to remote port forwarding (the equivalent of "ssh -L"). * * @param recvPort The port on this local machine that we'll listen to. 0 to let OS pick a random * available port. If you specify 0, use {@link ListeningPort#getPort()} to figure out the * actual assigned port. * @param forwardHost The remote host that the connection will be forwarded to. Connection to this * host will be made from the other JVM that this {@link Channel} represents. * @param forwardPort The remote port that the connection will be forwarded to. * @return */ public ListeningPort createLocalToRemotePortForwarding( int recvPort, String forwardHost, int forwardPort) throws IOException, InterruptedException { PortForwarder portForwarder = new PortForwarder(recvPort, ForwarderFactory.create(this, forwardHost, forwardPort)); portForwarder.start(); return portForwarder; }