Class Connection

java.lang.Object
de.iip_ecosphere.platform.deviceMgt.ssh.Connection
All Implemented Interfaces:
Runnable

public class Connection extends Object implements Runnable
Creates a connection between a remote and a client socket with the help of two instances of Proxy. Its connecting them by configure one proxy to proxy the client to the server and the other proxy to proxy the server to the client. Main parts were acquired from https://github.com/oksuz/tcp-proxy (MIT)
Author:
oksuz, Github on 29/10/2017.
  • Field Details

    • LOGGER

      private static final de.iip_ecosphere.platform.support.logging.Logger LOGGER
    • clientSocket

      private final Socket clientSocket
    • remoteIp

      private final String remoteIp
    • remotePort

      private final int remotePort
    • serverConnection

      private Socket serverConnection
    • clientServerThread

      private Thread clientServerThread
    • serverClientThread

      private Thread serverClientThread
  • Constructor Details

    • Connection

      public Connection(Socket clientSocket, String remoteIp, int remotePort)
      Sets up a connection between a client and a remote.
      Parameters:
      clientSocket - the client socket
      remoteIp - the remote ip address
      remotePort - the remote port
  • Method Details

    • run

      public void run()
      Runs the connection, should be run in combination with a thread. This method also checks if the connection is still up. After the client disconnects, the connection is closed.
      Specified by:
      run in interface Runnable
    • closeServerConnection

      private void closeServerConnection()
      Close the server Connection.