code: public static SshTunnelHandler openTunnel( String remoteHost, String remoteSshUser, String remoteSshPwd, int localPort,
              int remotePort ) throws JSchException {
          int port = 22;
          JSch jsch = new JSch();
          Session tunnelingSession = jsch.getSession(remoteSshUser, remoteHost, port);
          tunnelingSession.setPassword(remoteSshPwd);
          HMUserInfo lui = new HMUserInfo("");
          tunnelingSession.setUserInfo(lui);
          tunnelingSession.setConfig("StrictHostKeyChecking", "no");
          tunnelingSession.setPortForwardingL(localPort, "localhost", remotePort);
          tunnelingSession.connect();
          tunnelingSession.openChannel("direct-tcpip");
          return new SshTunnelHandler(tunnelingSession);
      }
docs: Open a tunnel to the remote host.
  
  @param remoteHost the host to connect to (where ssh will login).
  @param remoteSshUser the ssh user.
  @param remoteSshPwd the ssh password.
  @param localPort the local port to use for the port forwarding (usually the same as the remote).
  @param remotePort the remote port to use.
  @return the tunnel manager, used also to disconnect when necessary.
  @throws JSchException