Class LocalPortForwarder
- java.lang.Object
-
- net.schmizz.sshj.connection.channel.direct.LocalPortForwarder
-
public class LocalPortForwarder extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLocalPortForwarder.ForwardedChannel
-
Field Summary
Fields Modifier and Type Field Description private Connectionconnprivate org.slf4j.Loggerlogprivate LoggerFactoryloggerFactoryprivate Parametersparametersprivate java.lang.ThreadrunningThreadprivate java.net.ServerSocketserverSocket
-
Constructor Summary
Constructors Constructor Description LocalPortForwarder(Connection conn, Parameters parameters, java.net.ServerSocket serverSocket, LoggerFactory loggerFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the ServerSocket that's listening for connections to forward.booleanisRunning()Returns whether this listener is running (ie.voidlisten()Start listening for incoming connections and forward to remote host as a channel.voidlisten(java.lang.Thread runningThread)Start listening for incoming connections and forward to remote host as a channel and ensure that the thread is registered.private voidstartChannel(java.net.Socket socket)
-
-
-
Field Detail
-
loggerFactory
private final LoggerFactory loggerFactory
-
log
private final org.slf4j.Logger log
-
conn
private final Connection conn
-
parameters
private final Parameters parameters
-
serverSocket
private final java.net.ServerSocket serverSocket
-
runningThread
private java.lang.Thread runningThread
-
-
Constructor Detail
-
LocalPortForwarder
public LocalPortForwarder(Connection conn, Parameters parameters, java.net.ServerSocket serverSocket, LoggerFactory loggerFactory)
-
-
Method Detail
-
startChannel
private void startChannel(java.net.Socket socket) throws java.io.IOException- Throws:
java.io.IOException
-
listen
public void listen() throws java.io.IOExceptionStart listening for incoming connections and forward to remote host as a channel.- Throws:
java.io.IOException
-
isRunning
public boolean isRunning()
Returns whether this listener is running (ie. whether a thread is attached to it).- Returns:
-
listen
public void listen(java.lang.Thread runningThread) throws java.io.IOExceptionStart listening for incoming connections and forward to remote host as a channel and ensure that the thread is registered. This is useful if for instanceis called from another thread- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionClose the ServerSocket that's listening for connections to forward.- Throws:
java.io.IOException
-
-