public final class HttpPing
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
HttpPing.PingFailedException |
Constructor and Description |
---|
HttpPing(ProxyOptions options,
java.net.URL url)
Constructs an instance of HttpPing.
|
HttpPing(ProxyOptions options,
java.net.URL url,
int timeout)
Constructs an instance of HttpPing.
|
Modifier and Type | Method and Description |
---|---|
void |
ping()
Pings the URL specified in the constructor.
|
public HttpPing(ProxyOptions options, java.net.URL url)
options
- proxy options. Must not be null.url
- url to ping. Must not be null.public HttpPing(ProxyOptions options, java.net.URL url, int timeout)
options
- proxy options. Must not be null.url
- url to ping. Must not be null.timeout
- time out. Must be greater than or equal to zero.public void ping() throws HttpPing.PingFailedException
HttpPing.PingFailedException
.Note: this method executes synchronously (i.e. on the calling thread). It's recommended that callers invoke it on a background thread, since it will block until a connection is successful or the timeout period elapses.
HttpPing.PingFailedException
- if connection to the URL was unsuccessful.