rabbit.httpio
Class SimpleResolver

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

public class SimpleResolver
extends Object
implements Resolver

A simple resolver that uses the given dns handler.

Author:
Robert Olofsson

Constructor Summary
SimpleResolver(NioHandler nio, DNSHandler dnsHandler)
          Create a new Resolver that does normal DNS lookups.
 
Method Summary
 int getConnectPort(int port)
          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

SimpleResolver

public SimpleResolver(NioHandler nio,
                      DNSHandler dnsHandler)
Create a new Resolver that does normal DNS lookups.

Parameters:
nio - the NioHandler to use for running background tasks
dnsHandler - the DNSHandler to use for the DNS lookup
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 port)
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:
port - 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