use of com.jn.agileway.ssh.client.channel.forwarding.ForwardingChannelInfo in project agileway by fangjinuo.
the class J2sshForwardingClient method startRemoteForwarding.
@Override
public ForwardingChannelInfo startRemoteForwarding(String bindToHost, int bindToPort, String destHost, int destPort) throws SshException {
ForwardingChannelInfo channel = new ForwardingChannelInfo(ForwardingChannelInfo.REMOTE_FORWARDING_CHANNEL, bindToHost, bindToPort, destHost, destPort);
SshClient sshClient = this.connection.getDelegate();
com.sshtools.j2ssh.forwarding.ForwardingClient delegate = sshClient.getForwardingClient();
try {
if (!delegate.getRemoteForwardings().containsKey(ForwardingChannelInfo.id(channel))) {
delegate.addRemoteForwarding(ForwardingChannelInfo.id(channel), bindToHost, bindToPort, destHost, destPort);
}
delegate.startRemoteForwarding(ForwardingChannelInfo.id(channel));
} catch (Throwable ex) {
throw new SshException(ex);
}
return channel;
}
use of com.jn.agileway.ssh.client.channel.forwarding.ForwardingChannelInfo in project agileway by fangjinuo.
the class Ssh2ForwardingClient method startRemoteForwarding.
@Override
public ForwardingChannelInfo startRemoteForwarding(String bindToHost, int bindToPort, String destHost, int destPort) throws SshException {
Connection delegate = this.connection.getDelegate();
ForwardingChannelInfo channel = new ForwardingChannelInfo(ForwardingChannelInfo.REMOTE_FORWARDING_CHANNEL, bindToHost, bindToPort, destHost, destPort);
try {
delegate.requestRemotePortForwarding(bindToHost, bindToPort, destHost, destPort);
} catch (Throwable ex) {
throw new SshException(ex);
}
return channel;
}
Aggregations