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.
| Modifier and Type | Method and Description |
|---|---|
static ProxyResult |
direct()
Creates a DIRECT result with a generic reason.
|
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 |
of(String host,
int port)
Creates a PROXY result with a generic reason.
|
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 direct()
public static ProxyResult proxy(String host, int port, String reason)
public static ProxyResult of(String host, int port)
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.