When you need to make a SSH connection to connect to a server, you can create a left tunnel (a left port forwarding) to reach the server as of it was direct reachable.
Illustration: Image Credit: How does reverse SSH tunneling work? from Erik
You can create the tunnel with any client such as:
Create the tunnel: From the client host:
ssh -N -T -l loginName -L8881:farAwayServer:8888 sshServerHost
where
Jsch is a java library.
JSch jsch = new JSch();
Session session = jsch.getSession(user, host, port);
localPort = 4321;
remoteHost = "localhost";
remotePort = 3306;
session.setPassword(password);
session.setConfig("StrictHostKeyChecking", "no");
System.out.println("Establishing Connection...");
session.connect();
int assigned_port = session.setPortForwardingL(localPort, remoteHost, remotePort);