public final class ProxyResult extends Object
Provides both structured access (getHost(), getPort()) and a
convenience method toJavaProxy() to create a Proxy for
direct use with URLConnection or OkHttp.
ProxyResult result = WindowsProxyResolver.resolve("https://example.com");
if (result.isDirect()) {
conn = url.openConnection();
} else {
conn = url.openConnection(result.toJavaProxy());
}
| Modifier and Type | Method and Description |
|---|---|
static ProxyResult |
direct(String reason)
Creates a DIRECT result (no proxy needed).
|
String |
getHost()
Returns the proxy host, or
null for DIRECT results. |
int |
getPort()
Returns the proxy port, or
0 for DIRECT results. |
String |
getReason()
Returns a human-readable diagnostic reason for this result.
|
boolean |
isDirect()
Returns
true if the target URL should be accessed directly (no proxy). |
static ProxyResult |
proxy(String host,
int port,
String reason)
Creates a PROXY result.
|
Proxy |
toJavaProxy()
Converts to
Proxy. |
String |
toString() |
public static ProxyResult direct(String reason)
public static ProxyResult proxy(String host, int port, String reason)
public boolean isDirect()
true if the target URL should be accessed directly (no proxy).public String getHost()
null for DIRECT results.public int getPort()
0 for DIRECT results.public String getReason()
public Proxy toJavaProxy()
Proxy. Returns Proxy.NO_PROXY for DIRECT results.Copyright © 2026. All rights reserved.