public class TunnelConnection
extends java.lang.Object
implements java.io.Closeable
Tunnel's.| Constructor and Description |
|---|
TunnelConnection(SessionFactory sessionFactory,
int localPort,
java.lang.String destinationHostname,
int destinationPort)
Creates a TunnelConnection using the the
sessionFactory to
obtain its ssh connection with a single tunnel defined by
Tunnel(localPort, destinationHostname, destinationPort). |
TunnelConnection(SessionFactory sessionFactory,
java.util.List<Tunnel> tunnels)
Creates a TunnelConnection using the the
sessionFactory to
obtain its ssh connection with a list of
Tunnel's. |
TunnelConnection(SessionFactory sessionFactory,
Tunnel... tunnels)
Creates a TunnelConnection using the the
sessionFactory to
obtain its ssh connection with a list of
Tunnel's. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying ssh session causing all tunnels to be closed.
|
Tunnel |
getTunnel(java.lang.String destinationHostname,
int destinationPort)
Returns the tunnel matching the supplied values, or
null if
there isn't one that matches. |
boolean |
isOpen()
Returns true if the underlying ssh session is open.
|
void |
open()
Opens a session and connects all of the tunnels.
|
void |
reopen()
Closes, and re-opens the session and all its tunnels.
|
java.lang.String |
toString() |
public TunnelConnection(SessionFactory sessionFactory, int localPort, java.lang.String destinationHostname, int destinationPort)
sessionFactory to
obtain its ssh connection with a single tunnel defined by
Tunnel(localPort, destinationHostname, destinationPort).sessionFactory - The sessionFactorylocalPort - The local port to bind todestinationHostname - The destination hostname to tunnel todestinationPort - The destination port to tunnel topublic TunnelConnection(SessionFactory sessionFactory, Tunnel... tunnels)
sessionFactory to
obtain its ssh connection with a list of
Tunnel's.sessionFactory - The sessionFactorytunnels - The tunnelspublic TunnelConnection(SessionFactory sessionFactory, java.util.List<Tunnel> tunnels)
sessionFactory to
obtain its ssh connection with a list of
Tunnel's.sessionFactory - The sessionFactorytunnels - The tunnelspublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic Tunnel getTunnel(java.lang.String destinationHostname, int destinationPort)
null if
there isn't one that matches.destinationHostname - The tunnels destination hostnamedestinationPort - The tunnels destination portpublic boolean isOpen()
public void open()
throws com.jcraft.jsch.JSchException
com.jcraft.jsch.JSchException - If unable to connectpublic void reopen()
throws com.jcraft.jsch.JSchException
close() followed by a call to open().com.jcraft.jsch.JSchException - If unable to connectpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2018 pastdev.com. All Rights Reserved.