| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.String,java.util.List<java.net.InetAddress>> |
hostAddresses |
private int |
nextAddress |
private java.util.List<java.lang.String> |
requestedHosts |
| Constructor and Description |
|---|
FakeDns() |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<java.net.InetAddress> |
allocate(int count)
Allocates and returns
count fake addresses like [255.0.0.100, 255.0.0.101]. |
void |
assertRequests(java.lang.String... expectedHosts) |
FakeDns |
clear(java.lang.String hostname)
Clears the results for
hostname. |
java.util.List<java.net.InetAddress> |
lookup(java.lang.String hostname)
Returns the IP addresses of
hostname, in the order they will be attempted by OkHttp. |
java.net.InetAddress |
lookup(java.lang.String hostname,
int index) |
FakeDns |
set(java.lang.String hostname,
java.util.List<java.net.InetAddress> addresses)
Sets the results for
hostname. |
private final java.util.Map<java.lang.String,java.util.List<java.net.InetAddress>> hostAddresses
private final java.util.List<java.lang.String> requestedHosts
private int nextAddress
public FakeDns set(java.lang.String hostname, java.util.List<java.net.InetAddress> addresses)
hostname.public FakeDns clear(java.lang.String hostname)
hostname.public java.net.InetAddress lookup(java.lang.String hostname,
int index)
throws java.net.UnknownHostException
java.net.UnknownHostExceptionpublic java.util.List<java.net.InetAddress> lookup(java.lang.String hostname)
throws java.net.UnknownHostException
Dnshostname, in the order they will be attempted by OkHttp. If
a connection to an address fails, OkHttp will retry the connection with the next address until
either a connection is made, the set of IP addresses is exhausted, or a limit is exceeded.public void assertRequests(java.lang.String... expectedHosts)
public java.util.List<java.net.InetAddress> allocate(int count)
count fake addresses like [255.0.0.100, 255.0.0.101].