SSHFactory { public synchronized static void stopLocalPortForwarding(int port) throws JSchException { PortForwardingHandler handler = portForwardingMap.remove(port); if(handler != null) { handler.stopLocalPortForwarding(port); } }  static int openRemotePortToLocal(
			SshInfo remoteSshInfo,
			int remotePort,
			int localPort); synchronized static int openRemotePortToLocal(
			SshInfo remoteSshInfo,
			int remotePort1,
			int remotePort2,
			int localPort); static void stopRemotePortForwarding(int localPort); static int openLocalPortToRemote(
			SshInfo sshInfo,
			int localPort,
			String remoteHost,
			int remotePort); synchronized static void stopLocalPortForwarding(int port); static boolean isLocalPortUsing(int port); static void disConect(int localPort); @Deprecated static void uploadAndRunJarOnRemoteHost(
			SshInfo transitInfo,
			SshInfo remoteInfo,
			String jarPath,
			String remotePath,
			boolean replaceOnExist,
			String startupCmd,
			int execTimeout); static void execRemoteBooeEntity(
			IMessageBuilder mb,
			SshInfo transitInfo,
			SshInfo ssh,
			RemoteBootEntity rbe,
			int execTimeout); static List<PortLink> getPortLinks(); static synchronized boolean testForSSH(
			SshInfo transitInfo,
			SshInfo remoteInfo);  }
@Test public void testLocalPortForward() throws JSchException { SshInfo sshInfo=new SshInfo(); sshInfo.setHost("192.168.1.1") .setPort(22) .setPassword("password") .setUser("root"); PortForwardingHandler handler=new PortForwardingHandler(sshInfo); int localPort=handler.startLocalPortForwarding(10080, "8.8.8.8",22); handler.stopLocalPortForwarding(localPort); handler.disconnect(); }