However this affects that entire instance of the JVM, so any other outgoing connections will also try to use the proxy. That's probably fine in your case, but if you need more isolated scope you can use URL.openConnection(Proxy).