public class HTTPProxyData extends java.lang.Object implements ProxyData
HTTPProxyData object is used to specify the needed connection data
to connect through a HTTP proxy.Connection.setProxyData(ProxyData)| Constructor and Description |
|---|
HTTPProxyData(java.lang.String proxyHost,
int proxyPort)
Same as calling
HTTPProxyData(proxyHost, proxyPort, |
HTTPProxyData(java.lang.String proxyHost,
int proxyPort,
java.lang.String proxyUser,
java.lang.String proxyPass)
Same as calling
HTTPProxyData(proxyHost, proxyPort, |
HTTPProxyData(java.lang.String proxyHost,
int proxyPort,
java.lang.String proxyUser,
java.lang.String proxyPass,
java.lang.String[] requestHeaderLines)
Connection data for a HTTP proxy.
|
| Modifier and Type | Method and Description |
|---|---|
java.net.Socket |
openConnection(java.lang.String hostname,
int port,
int connectTimeout)
Connects the socket to the given destination using the proxy method that this instance
represents.
|
public HTTPProxyData(java.lang.String proxyHost,
int proxyPort)
HTTPProxyData(proxyHost, proxyPort, null, null)proxyHost - Proxy hostname.proxyPort - Proxy port.public HTTPProxyData(java.lang.String proxyHost,
int proxyPort,
java.lang.String proxyUser,
java.lang.String proxyPass)
HTTPProxyData(proxyHost, proxyPort, null, null, null)proxyHost - Proxy hostname.proxyPort - Proxy port.proxyUser - Username for basic authentication (null if no authentication is needed).proxyPass - Password for basic authentication (null if no authentication is needed).public HTTPProxyData(java.lang.String proxyHost,
int proxyPort,
java.lang.String proxyUser,
java.lang.String proxyPass,
java.lang.String[] requestHeaderLines)
Please note: if you want to use basic authentication, then both proxyUser
and proxyPass must be non-null.
Here is an example:
new HTTPProxyData("192.168.1.1", "3128", "proxyuser", "secret", new String[] {"User-Agent: TrileadBasedClient/1.0", "X-My-Proxy-Option: something"});
proxyHost - Proxy hostname.proxyPort - Proxy port.proxyUser - Username for basic authentication (null if no authentication is needed).proxyPass - Password for basic authentication (null if no authentication is needed).requestHeaderLines - An array with additional request header lines (without end-of-line markers)
that have to be sent to the server. May be null.public java.net.Socket openConnection(java.lang.String hostname,
int port,
int connectTimeout)
throws java.io.IOException
ProxyDataopenConnection in interface ProxyDatahostname - hostname of end host (not proxy)port - port of end host (not proxy)connectTimeout - number of seconds before giving up on connecting to end hostjava.io.IOException - if the connection could not be completed