Class TcpPortTest


  • public class TcpPortTest
    extends java.lang.Object
    Test the connection to a TCP server port.
    See Also:
    TcpPortTestWrapper
    • Constructor Summary

      Constructors 
      Constructor Description
      TcpPortTest​(java.lang.String host, int port)
      Create a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.ArrayList<java.lang.String> getConnectLog()
      Get the connect log.
      long getConnectTime()
      Get the TCP connect time in milliseconds.
      void setConnectTimeoutMillis​(int connectTimeoutMillis)
      Set the TCP connect timeout in milliseconds.
      void setLocalOutboundAddress​(java.lang.String localOutboundAddress)
      Set the local outbound address.
      boolean testConnection()
      Test the TCP connection.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TcpPortTest

        public TcpPortTest​(java.lang.String host,
                           int port)
        Create a new instance.
        Parameters:
        host - the server host
        port - the server port
    • Method Detail

      • setConnectTimeoutMillis

        public void setConnectTimeoutMillis​(int connectTimeoutMillis)
        Set the TCP connect timeout in milliseconds.
        Parameters:
        connectTimeoutMillis - the TCP connect timeout in milliseconds
      • setLocalOutboundAddress

        public void setLocalOutboundAddress​(java.lang.String localOutboundAddress)
                                     throws java.net.UnknownHostException
        Set the local outbound address.
        Parameters:
        localOutboundAddress - the local outbound address
        Throws:
        java.net.UnknownHostException - if the local outbound address is invalid
      • testConnection

        public boolean testConnection()
        Test the TCP connection.
        Returns:
        true if the TCP connection was established and then closed, or false if connecting to the server has failed.
      • getConnectLog

        public java.util.ArrayList<java.lang.String> getConnectLog()
        Get the connect log.
        Returns:
        the connect log
      • getConnectTime

        public long getConnectTime()
        Get the TCP connect time in milliseconds.
        Returns:
        the TCP connect time in milliseconds, or -1 if no such data is available