pwd.setPassword(password);
// Try the authentication
int result = ssh.authenticate(pwd);
// Evaluate the result
if (result == AuthenticationProtocolState.COMPLETE) {
ForwardingClient forwarding = ssh.getForwardingClient();
forwarding.addLocalForwarding("Test Local", "0.0.0.0", 8081,
"127.0.0.1", 80);
forwarding.startLocalForwarding("Test Local");
forwarding.addRemoteForwarding("Test Remote", "0.0.0.0", 8081,
"127.0.0.1", 8080);
forwarding.startRemoteForwarding("Test Remote");
}
ssh.getConnectionState().waitForState(TransportProtocolState.DISCONNECTED);
}
catch (Exception e) {
e.printStackTrace();