Class SocketManager


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

      Fields 
      Modifier and Type Field Description
      static int CONNECTION_SLEEP_TIME
      Connection validation sleep in milliseconds.
    • 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, java.lang.String uuid)
      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
    • Field Detail

      • CONNECTION_SLEEP_TIME

        public static final int CONNECTION_SLEEP_TIME
        Connection validation sleep in milliseconds.
        See Also:
        Constant Field Values
    • 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,
                               java.lang.String uuid)
                        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.
        uuid - Uuid sent by the Agent to verify connection.
        Throws:
        AgentConnectException - When connection fails.
      • isOpen

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