Class TcpGateway

  • All Implemented Interfaces:
    Gateway

    public class TcpGateway
    extends Object
    implements Gateway
    A Gateway implementation which uses TCP protocol stack to communicate.
    Author:
    uros.bregar
    • Constructor Detail

    • Method Detail

      • connect

        public void connect()
                     throws IOException
        Attempts to establish a connection to the remote site.
        Specified by:
        connect in interface Gateway
        Throws:
        IOException - There was an error establishing the connection.
      • disconnect

        public void disconnect​(boolean dueToError)
        Drops the established connection.
        Specified by:
        disconnect in interface Gateway
        Parameters:
        dueToError - - when false user wished to close connection; when true there was a problem and we had to close it
      • isConnected

        public boolean isConnected()
        Gets a value specifying whether the connection to the remote site is established.
        Specified by:
        isConnected in interface Gateway
        Returns:
        Value specifying whether the connection to the remote site is established.
      • getLastReceivedMsgTimestamp

        public long getLastReceivedMsgTimestamp()
        Gets last timestamp in unix millis when the last msg was received
        Specified by:
        getLastReceivedMsgTimestamp in interface Gateway
        Returns:
        timestamp when the last msg was received
      • getId

        public String getId()
        Description copied from interface: Gateway
        Gets gateway id (hostname, port, ...)
        Specified by:
        getId in interface Gateway
        Returns:
        gateway identification