Package com.iizix.test.client
Class DestinationServer
- java.lang.Object
- com.iizix.test.client.DestinationServer
public class DestinationServer extends java.lang.Object
The destination server to contact. This class is not thread safe.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description DestinationServer(java.lang.String hostName, int port, boolean isSecure, boolean isRedirectionAllowed)
Constructor.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Checks if two destination server object are equal.java.lang.String
getHostName()
Gets the server host name.int
getPort()
Gets the port of the server.int
hashCode()
Returns the hashCode.boolean
isDefaultPort()
Checks if it's the default port.boolean
isRedirectionAllowed()
Returns whether redirection to another server is allowed.boolean
isSecure()
Gets if SSL is used or not.java.lang.String
toString()
Creates a string representation of the instance.
Constructor Detail
DestinationServer
public DestinationServer(java.lang.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:
java.lang.NullPointerException
- IfhostName
is null.java.lang.IllegalArgumentException
- If port is not -1 or in range of 1-65535.
Method Detail
getHostName
public java.lang.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 java.lang.String toString()
Creates a string representation of the instance.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A String formatted as hostName[:port][,secure][,redirectionAllowed].
hashCode
public int hashCode()
Returns the hashCode.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- The hash code.
equals
public boolean equals(java.lang.Object obj)
Checks if two destination server object are equal.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- The object to compare with.- Returns:
- Equals flag.