public class ProxyOptions extends Object
| Modifier and Type | Field and Description |
|---|---|
static java.time.Duration |
DEFAULT_CONNECT_TIMEOUT
The default timeout for proxy connect = 10 seconds
|
static String |
DEFAULT_HOST
The default hostname for proxy connect = "localhost"
|
static int |
DEFAULT_PORT
The default port for proxy connect = 3128
|
static ProxyType |
DEFAULT_TYPE
The default proxy type (HTTP)
|
| Constructor and Description |
|---|
ProxyOptions()
Default constructor.
|
ProxyOptions(JsonObject json)
Create options from JSON.
|
ProxyOptions(ProxyOptions other)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.time.Duration |
getConnectTimeout()
Get the connection timeout , defaults to
10 seconds. |
String |
getHost()
Get proxy host.
|
String |
getPassword()
Get proxy password.
|
int |
getPort()
Get proxy port.
|
ProxyType |
getType()
Get proxy type.
|
String |
getUsername()
Get proxy username.
|
ProxyOptions |
setConnectTimeout(java.time.Duration connectTimeout)
Set the connection timeout.
|
ProxyOptions |
setHost(String host)
Set proxy host.
|
ProxyOptions |
setPassword(String password)
Set proxy password.
|
ProxyOptions |
setPort(int port)
Set proxy port.
|
ProxyOptions |
setType(ProxyType type)
Set proxy type.
|
ProxyOptions |
setUsername(String username)
Set proxy username.
|
JsonObject |
toJson()
Convert to JSON
|
public static final ProxyType DEFAULT_TYPE
public static final int DEFAULT_PORT
3128 is the default port for Squid
public static final String DEFAULT_HOST
public static final java.time.Duration DEFAULT_CONNECT_TIMEOUT
public ProxyOptions()
public ProxyOptions(ProxyOptions other)
other - the options to copypublic ProxyOptions(JsonObject json)
json - the JSONpublic JsonObject toJson()
public String getHost()
public ProxyOptions setHost(String host)
host - the proxy host to connect topublic int getPort()
public ProxyOptions setPort(int port)
port - the proxy port to connect topublic String getUsername()
public ProxyOptions setUsername(String username)
username - the proxy usernamepublic String getPassword()
public ProxyOptions setPassword(String password)
password - the proxy passwordpublic ProxyType getType()
ProxyType can be HTTP, SOCKS4 and SOCKS5
public ProxyOptions setType(ProxyType type)
ProxyType can be HTTP, SOCKS4 and SOCKS5
type - the proxy type to connect topublic java.time.Duration getConnectTimeout()
10 seconds.
A connection to the proxy is considered successful when:
200 response to the CONNECT request for HTTP proxies, orSOCKS handshake ended with the SUCCESS status, for SOCKS proxies.public ProxyOptions setConnectTimeout(java.time.Duration connectTimeout)
connectTimeout - the connection timeoutCopyright © 2025 Eclipse. All rights reserved.