Here you can find the source of getHttpURLConnection(URL url)
public static HttpURLConnection getHttpURLConnection(URL url) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.Proxy; import java.net.URL; public class Main { private static Proxy proxy = null; public static HttpURLConnection getHttpURLConnection(String urlString) throws MalformedURLException, IOException { return getHttpURLConnection(new URL(urlString)); }/* w ww . j av a 2 s . c o m*/ public static HttpURLConnection getHttpURLConnection(URL url) throws IOException { if (proxy != null) { return (HttpURLConnection) url.openConnection(proxy); } else { return (HttpURLConnection) url.openConnection(); } } }