AsyncHttpClient/async-http-client — pull request #362 by jroper (2013-08-19 08:21:55+00:00)
Title: Added support for java.net.ProxySelector

Fixes #360.

Summary:

* Instead of AsyncHttpClientConfig having a ProxyServer, it now has a ProxyServerSelector.
* Methods that configure a ProxyServer now take the passed in ProxyServer and configure a selector that always returns that ProxyServer.
* Although I could have moved the nonProxyHosts handling into the ProxyServerSelector implementation, I didn't because users might still configure a ProxyServer per request that has nonProxyHosts configuration, and so this handling needs to go through the current avoidHosts methods.
* Added an option called useProxySelector that tells async-http-client to use an implementation of ProxyServerSelector that wraps the JDK default ProxySelector. This allows for much more complex proxy selection, such as a proxy.pac based implementation from the Proxy Vole project.
* Kept the useProxyProperties option and its current implementation, because it offers some things that ProxySelector can't provide, for example, using HTTPS and other protocols to connect to the proxy.
* Fixed a bug in useProxyProperties nonProxyHosts handling, where only wildcards at the front of the nonProxyHosts config were being honoured, but the JDK docs indicate that wildcards are permitted both at the front and at the end.
* Fixed a turkish i bug in nonProxyHosts matching.
* Fixed a bug in the ProxyUtils.createProxy method where it was ignoring the passed in Properties, and going directly to System.getProperty.
* Documented both useProxyProperties and useProxySelector.