public class ProxyConfiguration extends Object implements AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
static ProxyConfiguration |
SYSTEM_DEFAULTS
Gets the system defaults for proxy configuration and authentication.
|
| Constructor and Description |
|---|
ProxyConfiguration(ProxyAuthenticationType authentication,
Proxy proxyAddress,
String username,
String password)
Creates a proxy configuration that uses the
proxyAddress and authenticates with provided username, password and authentication. |
| Modifier and Type | Method and Description |
|---|---|
ProxyAuthenticationType |
authentication()
Gets the proxy authentication type to use.
|
void |
close() |
PasswordAuthentication |
credentials()
Gets credentials to authenticate against proxy with.
|
boolean |
hasUserDefinedCredentials()
Gets whether the user has defined credentials.
|
boolean |
isProxyAddressConfigured()
Gets whether the proxy address has been configured.
|
Proxy |
proxyAddress()
Gets the proxy address.
|
public static final ProxyConfiguration SYSTEM_DEFAULTS
public ProxyConfiguration(ProxyAuthenticationType authentication, Proxy proxyAddress, String username, String password)
proxyAddress and authenticates with provided username, password and authentication.authentication - Authentication method to preemptively use with proxy.proxyAddress - Proxy to use. If null is passed in, then the system configured Proxy is used.username - Optional. Username used to authenticate with proxy. If not specified, the system-wide
Authenticator is used to fetch credentials.password - Optional. Password used to authenticate with proxy.NullPointerException - if authentication is null.IllegalArgumentException - if authentication is ProxyAuthenticationType.BASIC or
ProxyAuthenticationType.DIGEST and username or password are null.public Proxy proxyAddress()
null if user creates proxy credentials with SYSTEM_DEFAULTS.public PasswordAuthentication credentials()
null if no credentials were set. This
occurs when user uses SYSTEM_DEFAULTS.public ProxyAuthenticationType authentication()
null if no authentication type was set. This occurs
when user uses SYSTEM_DEFAULTS.public boolean hasUserDefinedCredentials()
public boolean isProxyAddressConfigured()
public void close()
close in interface AutoCloseableCopyright © 2020. All rights reserved.