I know Java supports the use of proxies either by setting system property:
System.setProperty("http.proxyHost", "domain.com"); System.setPropery("http.proxyPort", "8080"); Or by using the ProxySelector class.
The benefit of using ProxySelector class is that it can be enabled just for a specific URL.
My needs are a bit different.
I want to set a specific proxy when making a connection to an external (SOAP) web service but I want to change the proxy for each thread. In other words, I will be connecting to SOAP web service using multiple threads and I want thread a to use proxy a, thread b to use proxy b and so on (instead of using one proxy throughout the entire JVM)
Is this possible?
Clarification: I would like to have access to two+ different proxies at the same time, not sequentially so any solution which requires me to lock/synchronize access will not work.