Class LocalPortForwarder


  • public class LocalPortForwarder
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close the ServerSocket that's listening for connections to forward.
      boolean isRunning()
      Returns whether this listener is running (ie.
      void listen()
      Start listening for incoming connections and forward to remote host as a channel.
      void listen​(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 void startChannel​(java.net.Socket socket)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        private final org.slf4j.Logger log
      • serverSocket

        private final java.net.ServerSocket serverSocket
      • runningThread

        private java.lang.Thread runningThread
    • Constructor Detail

    • 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.IOException
        Start 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.IOException
        Start listening for incoming connections and forward to remote host as a channel and ensure that the thread is registered. This is useful if for instance is called from another thread
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Close the ServerSocket that's listening for connections to forward.
        Throws:
        java.io.IOException