use of net.schmizz.sshj.connection.channel.forwarded.SocketForwardingConnectListener in project agileway by fangjinuo.
the class SshjForwardingClient method startRemoteForwarding.
@Override
public ForwardingChannelInfo startRemoteForwarding(String bindToHost, int bindToPort, String destHost, int destPort) throws SshException {
SSHClient delegate = connection.getDelegate();
RemotePortForwarder forwarder = delegate.getRemotePortForwarder();
RemotePortForwarder.Forward forward = new RemotePortForwarder.Forward(bindToHost, bindToPort);
try {
forwarder.bind(forward, new SocketForwardingConnectListener(new InetSocketAddress(bindToHost, bindToPort)));
} catch (Throwable ex) {
throw new SshException(ex);
}
return new ForwardingChannelInfo(ForwardingChannelInfo.REMOTE_FORWARDING_CHANNEL, bindToHost, bindToPort, destHost, destPort);
}
Aggregations