Class SocketManager


  • public final class SocketManager
    extends java.lang.Object
    Manages the development TCP socket connection.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void closeSocket()
      Closes the TCP socket connection to the Agent.
      static SocketManager getInstance()
      Static method to obtain a singleton instance of the class.
      boolean isOpen()
      Checks whether the socket is open or closed.
      void openSocket​(java.lang.String host, int port)
      Opens a TCP socket connection to the Agent using provided host and port.
      • Methods inherited from class java.lang.Object

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

      • getInstance

        public static SocketManager getInstance()
        Static method to obtain a singleton instance of the class.
        Returns:
        SocketManager instance.
      • closeSocket

        public void closeSocket()
        Closes the TCP socket connection to the Agent.
      • openSocket

        public void openSocket​(java.lang.String host,
                               int port)
                        throws AgentConnectException
        Opens a TCP socket connection to the Agent using provided host and port. Does effectively nothing if already connected.
        Parameters:
        host - Host to connect.
        port - Port to connect.
        Throws:
        AgentConnectException - When connection fails.
      • isOpen

        public boolean isOpen()
        Checks whether the socket is open or closed.
        Returns:
        True if open, otherwise False.