I am trying to connect to a server through a jump server. I am using Jsch 0.51 and trying to connect using the setPortForwardingL
method.
However, I am getting the following exception while connecting:
java.net.ConnectException: Connection timed out
I am basically following the example given here: http://www.jcraft.com/jsch/examples/JumpHosts.java.html
What could be the reasons for this exception?
Edit: Adding the code snippet which is throwing the exception:
//Trying to connect to the Jump server in this snippet
JSch jsch = new JSch();
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
Session session = jsch.getSession(username, hostname, 22);
session.setPassword(password);
session.setConfig(config);
session.connect(); //Getting the ConnectException here