protected class ForwardingClient.ForwardingListener extends Object implements ForwardingRequestListener
Modifier | Constructor and Description |
---|---|
protected |
ForwardingListener() |
Modifier and Type | Method and Description |
---|---|
SshTransport |
createConnection(String hostToConnect,
int portToConnect)
Create a connection to the specified host.
|
void |
initializeTunnel(SshTunnel tunnel)
Called once a connection has been established and a forwarding channel
is about to be opened.
|
public SshTransport createConnection(String hostToConnect, int portToConnect) throws SshException
ForwardingRequestListener
createConnection
in interface ForwardingRequestListener
SshException
SshTransport
public void initializeTunnel(SshTunnel tunnel)
ForwardingRequestListener
public void initializeTunnel(SshTunnel tunnel) { tunnel.addChannelEventListener(new ChannelAdapter() { public void channelOpened(SshChannel channel) { // Cast the channel into a tunnel SshTunnel tunnel = (SshTunnel)channel; // Create a pair of IOStreamConnectors to transfer the data IOStreamConnector tx = new IOStreamConnector(); tx.connect(tunnel.getInputStream(), tunnel.getTransport().getOutputStream()); IOStreamConnector rx = new IOStreamConnector(); tx.connect(tunnel.getTransport().getInputStream(), tunnel.getOutputStream()); } }); }
initializeTunnel
in interface ForwardingRequestListener
Copyright © 2024. All rights reserved.