title: How to get URL connection using proxy in java?
body: <p>I am trying to create URL connection using a proxy at run time. My code is below:</p>
  
  <pre><code>Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("192.0.2.100", 80));
  HttpURLConnection connection =
      (HttpURLConnection)new URL("http://abc.example.com").openConnection(proxy);
  </code></pre>
  
  <p>But this is not working. Anybody know why?</p>