Class JavaProxySearchStrategy
java.lang.Object
com.github.markusbernhardt.proxy.search.java.JavaProxySearchStrategy
- All Implemented Interfaces:
ProxySearchStrategy
Reads some java system properties and extracts the proxy settings from them.
The following variables are read:
- http.proxyHost (default: none)
- http.proxyPort (default: 80 if http.proxyHost specified)
- http.nonProxyHosts (default: none)
- https.proxyHost (default: none)
- https.proxyPort (default: 443 if https.proxyHost specified)
- ftp.proxyHost (default: none)
- ftp.proxyPort (default: 80 if ftp.proxyHost specified)
- ftp.nonProxyHosts (default: none)
- socksProxyHost
- socksProxyPort (default: 1080)
This is based on information found here:
http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor Will use the default environment variables. -
Method Summary
Modifier and TypeMethodDescriptiongetName()
Gets the printable name of the search strategy.Loads the proxy settings from environment variables.private void
setupProxyForProtocol
(ProtocolDispatchSelector ps, String protocol, int defaultPort) Parse properties for the given protocol.private boolean
Parse SOCKS settings
-
Constructor Details
-
JavaProxySearchStrategy
public JavaProxySearchStrategy()Constructor Will use the default environment variables.
-
-
Method Details
-
getProxySelector
Loads the proxy settings from environment variables.- Specified by:
getProxySelector
in interfaceProxySearchStrategy
- Returns:
- a configured ProxySelector, null if none is found.
-
getName
Gets the printable name of the search strategy.- Specified by:
getName
in interfaceProxySearchStrategy
- Returns:
- the printable name of the search strategy
-
setupSocktProxy
Parse SOCKS settings- Parameters:
ps
-- Throws:
NumberFormatException
-
setupProxyForProtocol
Parse properties for the given protocol.- Parameters:
ps
-protocol
-- Throws:
NumberFormatException
-