How can I set the SOCKS proxy for a URLConnection given by (new URL(url)).openConnection()?
Different proxies are needed on a per-connection basis, so please don’t suggest setting system properties.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to use different proxy settings on a per-connection bases, you can use the Java 6.0
ProxySelectormechanism as described in Java Networking and Proxies. Specifically, read sections 3 and 4.