Hi All,
I am trying to implement ssh port forwarding future in my code, i tried following steps with both Ganymed and JSCH libraries.
I have two unix boxses tunnleFrom and ExtSystem.
ExtSystem : where my stub is listning on port 10023, this stub is suppose to respond on incomning requests.
tunnleFrm : where i have run ssh -g -L11023:ExtSystem:10023 user2@tunnleFrm
Now if i fire http request
http://tunnleFrm:11023 through IE my stub is responding correctly means the ssh port forwarding is working ok.
But if i send request through following code my code runs succesfully but i won't get any response from stub (am sure that request is not getting forwarded to stub).
System.out.println("port forwarding starts");
String hostname = "tunnleFrm";
String username = "user2";
String password = "user2";
Connection conn = new Connection(hostname);
conn.connect();
boolean isAuthenticated = conn.authenticateWithPassword(username, password);
if (isAuthenticated == false)
throw new IOException("Authentication failed.");
LocalPortForwarder lpf1 = conn.createLocalPortForwarder(11023, "ExtSystem", 10023);
Session sess = conn.openSession();
System.out.println("created ssh session ");
//sess.startShell();
sess.execCommand("qdn 9999999999");
System.out.println("Executed command ");
Thanks & Regards,
-Sachin.