Package org.apache.http.impl.conn
Class InMemoryDnsResolver
java.lang.Object
org.apache.http.impl.conn.InMemoryDnsResolver
- All Implemented Interfaces:
DnsResolver
In-memory
DnsResolver
implementation.- Since:
- 4.2
-
Constructor Summary
ConstructorsConstructorDescriptionBuilds a DNS resolver that will resolve the host names against a collection held in-memory. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(String host, InetAddress... ips) Associates the given array of IP addresses to the given host in this DNS overrider.Returns the IP address for the specified host name, or null if the given host is not recognized or the associated IP address cannot be used to build an InetAddress instance.
-
Constructor Details
-
InMemoryDnsResolver
public InMemoryDnsResolver()Builds a DNS resolver that will resolve the host names against a collection held in-memory.
-
-
Method Details
-
add
Associates the given array of IP addresses to the given host in this DNS overrider. The IP addresses are assumed to be already resolved.- Parameters:
host
- The host name to be associated with the given IP.ips
- array of IP addresses to be resolved by this DNS overrider to the given host name.
-
resolve
Returns the IP address for the specified host name, or null if the given host is not recognized or the associated IP address cannot be used to build an InetAddress instance.- Specified by:
resolve
in interfaceDnsResolver
- Parameters:
host
- The host name to be resolved by this resolver.- Returns:
- The IP address associated to the given host name, or null if the host name is not known by the implementation class.
- Throws:
UnknownHostException
- See Also:
-