Class DestinationServer

java.lang.Object
com.iizix.test.client.DestinationServer

public class DestinationServer extends Object
The destination server to contact. This class is not thread safe.
Author:
Christopher Mindus
  • Constructor Details

    • DestinationServer

      public DestinationServer(String hostName, int port, boolean isSecure, boolean isRedirectionAllowed)
      Constructor.
      Parameters:
      hostName - The server host name.
      port - Port number, -1 for default (80 for non-secure, 443 for secure).
      isSecure - Flag for server secure.
      isRedirectionAllowed - Flag for redirection allowed.
      Throws:
      NullPointerException - If hostName is null.
      IllegalArgumentException - If port is not -1 or in range of 1-65535.
  • Method Details

    • getHostName

      public String getHostName()
      Gets the server host name.
      Returns:
      The host name.
    • isDefaultPort

      public boolean isDefaultPort()
      Checks if it's the default port.
      Returns:
      true if port is -1 or port is 80 and it's not secure, or 443 and it's secure, false otherwise.
    • getPort

      public int getPort()
      Gets the port of the server.
      Returns:
      The port, where the value -1 for default is changed to 80 for non-secure, or 443 for secure.
    • isSecure

      public boolean isSecure()
      Gets if SSL is used or not.
      Returns:
      The isSecure flag.
    • isRedirectionAllowed

      public boolean isRedirectionAllowed()
      Returns whether redirection to another server is allowed.
      Returns:
      The isRedirectionAllowed flag.
    • toString

      public String toString()
      Creates a string representation of the instance.
      Overrides:
      toString in class Object
      Returns:
      A String formatted as hostName[:port][,secure][,redirectionAllowed].
    • hashCode

      public int hashCode()
      Returns the hashCode.
      Overrides:
      hashCode in class Object
      Returns:
      The hash code.
    • equals

      public boolean equals(Object obj)
      Checks if two destination server object are equal.
      Overrides:
      equals in class Object
      Parameters:
      obj - The object to compare with.
      Returns:
      Equals flag.