ice.net
Class Indirect

java.lang.Object
  extended byice.net.ConnectionRoute
      extended byice.net.Indirect
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Proxy, Socks

public abstract class Indirect
extends ConnectionRoute
implements Serializable

This is the base implementation of an ConnectionRoute that has an indirect connection route to get to the host of the requested URL.

Since:
1.5
Version:
1.5
Author:
Jack van Ooststroom
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ice.net.ConnectionRoute
KNOWN_BAD, KNOWN_GOOD, UNTESTED
 
Constructor Summary
protected Indirect(String host, int port)
          Constructs an Indirect with the specified host and port.
 
Method Summary
protected  void checkHost(String host)
          Convenience method to check the specified host for validity.
protected  void checkPort(int port)
          Convenience method to check the specified port for validity.
 boolean equals(Object object)
           
 String getHost()
          Returns the host name of this Indirect.
 int getPort()
          Returns the port number of this Indirect.
 int getStatus()
          Returns the status of this Indirect.
 void setStatus(int status)
          Sets this Indirect's status to the specified status.
 
Methods inherited from class ice.net.ConnectionRoute
checkStatus, getRequestedUrl, setRequestedUrl
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Indirect

protected Indirect(String host,
                   int port)
            throws IllegalArgumentException

Constructs an Indirect with the specified host and port.

Parameters:
host - the host name of the Indirect to be created.
port - the port number of the Indirect to be created.
Throws:
IllegalArgumentException - if one of the following occurs:
See Also:
ConnectionRoute.ConnectionRoute()
Method Detail

equals

public boolean equals(Object object)
Overrides:
equals in class ConnectionRoute

getHost

public final String getHost()

Returns the host name of this Indirect.

Note: this returns the host name of the Indirect connection route, not the host name of the requested URL!

Returns:
the host name.
See Also:
ConnectionRoute.getRequestedUrl()

getPort

public final int getPort()

Returns the port number of this Indirect.

Note: this returns the port number of the Indirect connection route, not the port number of the requested URL!

Returns:
the port number.
See Also:
ConnectionRoute.getRequestedUrl()

getStatus

public final int getStatus()

Returns the status of this Indirect.

Overrides:
getStatus in class ConnectionRoute
Returns:
the status.
See Also:
setStatus(int), ConnectionRoute.UNTESTED, ConnectionRoute.KNOWN_GOOD, ConnectionRoute.KNOWN_BAD

setStatus

public final void setStatus(int status)

Sets this Indirect's status to the specified status.

Overrides:
setStatus in class ConnectionRoute
Parameters:
status - the new status.
See Also:
getStatus(), ConnectionRoute.UNTESTED, ConnectionRoute.KNOWN_GOOD, ConnectionRoute.KNOWN_BAD

checkHost

protected final void checkHost(String host)
                        throws IllegalArgumentException

Convenience method to check the specified host for validity.

The specified host is only valid if all of the following applies:

  • it is not null;
  • it is not empty, that is host.trim().length() != 0.

Parameters:
host - the host name to be checked.
Throws:
IllegalArgumentException - if the specified host is either null or empty.

checkPort

protected final void checkPort(int port)
                        throws IllegalArgumentException

Convenience method to check the specified port for validity.

The specified port is only valid if all of the following applies:

  • it is greater than or equal to 0,
  • it is lesser than or equal to 65536.

Parameters:
port - the port number to be checked.
Throws:
IllegalArgumentException - if the specified port is either less than 0 or greater than 65536.