public class ProxyConfig extends SocksProxyConfig
In case a proxy is required, the properties "mail.smtp.socks.host" and "mail.smtp.socks.port" will be set.
As the underlying JavaMail framework only support anonymous SOCKS proxy servers for non-ssl connections, authenticated SOCKS5 proxy is made possible using an intermediary anonymous proxy server which relays the connection through an authenticated remote proxy server. Anonymous proxies are still handled by JavaMail's own time-tested proxy client implementation.
Attempting to use a proxy and SSL SMTP authentication will result in an error, as the underlying JavaMail framework ignores any proxy settings for SSL connections.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PROXY_BRIDGE_PORT
The temporary intermediary SOCKS5 relay server bridge is a server that sits in between JavaMail and the remote proxy.
|
password, proxyBridgePort, remoteProxyHost, remoteProxyPort, username
Constructor and Description |
---|
ProxyConfig()
'Skip proxy' constructor short-cut.
|
ProxyConfig(String remoteProxyHost,
Integer remoteProxyPort)
'Anonymous proxy' constructor short-cut.
|
ProxyConfig(String remoteProxyHost,
Integer remoteProxyPort,
String username,
String password)
Creates an proxy configuration, which can be anonymous or authenticated.
|
Modifier and Type | Method and Description |
---|---|
String |
getPassword() |
int |
getProxyBridgePort() |
String |
getRemoteProxyHost() |
Integer |
getRemoteProxyPort() |
String |
getUsername() |
boolean |
requiresAuthentication()
If a username was provided, we will need to authenticate with the proxy.
|
boolean |
requiresProxy()
If a host was provided then proxy is required.
|
void |
setProxyBridgePort(int proxyBridgePort) |
String |
toString() |
public static final int DEFAULT_PROXY_BRIDGE_PORT
public ProxyConfig()
public ProxyConfig(String remoteProxyHost, Integer remoteProxyPort)
remoteProxyHost
- The host of the remote proxy.remoteProxyPort
- The port of the remote proxy.ProxyConfig(String, Integer, String, String)
public ProxyConfig(String remoteProxyHost, Integer remoteProxyPort, String username, String password)
remoteProxyHost
- The host of the remote proxy.remoteProxyPort
- The port of the remote proxy.username
- Username is mandatory when authentication is required.password
- Password is mandatory when authentication is required.public boolean requiresProxy()
public boolean requiresAuthentication()
public int getProxyBridgePort()
public void setProxyBridgePort(int proxyBridgePort)
proxyBridgePort
- Port override for the temporary intermediary SOCKS5 relay server bridge (default is 1081).public String getRemoteProxyHost()
public Integer getRemoteProxyPort()
public String getUsername()
public String getPassword()
Copyright © 2017. All rights reserved.