rabbit.httpio
Class ProxyResolver

java.lang.Object
  extended by rabbit.httpio.ProxyResolver
All Implemented Interfaces:
Resolver

public class ProxyResolver
extends Object
implements Resolver

A resolver that always return the proxy address.

Author:
Robert Olofsson

Constructor Summary
ProxyResolver(InetAddress proxy, int port, String auth)
          Create a new ProxyResolver that will always return the given address.
 
Method Summary
 int getConnectPort(int wantedPort)
          Get the port to use for connecting to a given port.
 void getInetAddress(URL url, InetAddressListener listener)
          Get the InetAddress for a given url.
 String getProxyAuthString()
          Get the currently set proxy authentication.
 boolean isProxyConnected()
          Check if the resolver is using a proxy or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyResolver

public ProxyResolver(InetAddress proxy,
                     int port,
                     String auth)
Create a new ProxyResolver that will always return the given address.

Parameters:
proxy - the upstream proxy to use for all requests
port - the upstream proxy port to use for all requests
auth - the upstream proxy basic auth string to use for all request
Method Detail

getInetAddress

public void getInetAddress(URL url,
                           InetAddressListener listener)
Description copied from interface: Resolver
Get the InetAddress for a given url. Normally the InetAddress of the url host, but might be the InetAddress of the chained proxy to use.

Specified by:
getInetAddress in interface Resolver
Parameters:
url - the URL to lookup.
listener - the InetAddressListener to notify when lookup is done.

getConnectPort

public int getConnectPort(int wantedPort)
Description copied from interface: Resolver
Get the port to use for connecting to a given port. Normally port is returned, but if there is a chained proxy, then the proxy port is returned instead.

Specified by:
getConnectPort in interface Resolver
Parameters:
wantedPort - the port number we are trying to use
Returns:
the tcp port number to use

isProxyConnected

public boolean isProxyConnected()
Description copied from interface: Resolver
Check if the resolver is using a proxy or not.

Specified by:
isProxyConnected in interface Resolver
Returns:
true if there is an upstream proxy

getProxyAuthString

public String getProxyAuthString()
Description copied from interface: Resolver
Get the currently set proxy authentication.

Specified by:
getProxyAuthString in interface Resolver
Returns:
the upstream proxy basic identification header