public class ProxyBuilder
extends java.lang.Object
Proxy
instances.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_HTTP_PROXY_ENV_VAR |
Modifier | Constructor and Description |
---|---|
protected |
ProxyBuilder() |
Modifier and Type | Method and Description |
---|---|
ProxyBuilder |
address(java.net.InetSocketAddress inetSocketAddress) |
java.net.Proxy |
build() |
static ProxyBuilder |
create()
Returns a new ProxyBuilder instance.
|
static ProxyBuilder |
create(java.lang.String hostname,
int port)
Returns a new ProxyBuilder instance initialized with the given hostname and port.
|
static ProxyBuilder |
from(java.lang.String proxyUrl)
Returns a ProxyBuilder initialized from the given proxy server URL.
|
static ProxyBuilder |
fromDefaultEnvVar()
Returns a ProxyBuilder initialized from environment variable "HTTP_PROXY".
|
static ProxyBuilder |
fromEnvVar(java.lang.String envVarName)
Returns a ProxyBuilder initialized from the given environment variable.
|
protected java.net.InetSocketAddress |
getAddress() |
protected java.net.Proxy.Type |
getType() |
protected void |
setAddress(java.net.InetSocketAddress address) |
protected void |
setType(java.net.Proxy.Type type) |
ProxyBuilder |
type(java.net.Proxy.Type proxyType) |
public static final java.lang.String DEFAULT_HTTP_PROXY_ENV_VAR
public static ProxyBuilder create()
public static ProxyBuilder create(java.lang.String hostname, int port)
public static ProxyBuilder fromDefaultEnvVar()
ConfigRuntimeException
- If the specified environment variable cannot be found.InvalidUrlException
- If the value of the specified environment variable is no valid URL.public static ProxyBuilder fromEnvVar(java.lang.String envVarName)
envVarName
- The name of the environment variable that specifies the proxy URL (must not be null).ConfigRuntimeException
- If the specified environment variable cannot be found.InvalidUrlException
- If the value of the specified environment variable is no valid URL.public static ProxyBuilder from(java.lang.String proxyUrl)
proxyUrl
- The proxy URL with scheme, host and port (must not be null).InvalidUrlException
- If the value of the specified environment variable is no valid URL.public ProxyBuilder type(java.net.Proxy.Type proxyType)
public ProxyBuilder address(java.net.InetSocketAddress inetSocketAddress)
public java.net.Proxy build()
protected java.net.Proxy.Type getType()
protected void setType(java.net.Proxy.Type type)
protected java.net.InetSocketAddress getAddress()
protected void setAddress(java.net.InetSocketAddress address)