public static HttpURLConnection getConnection(URL url, Proxy proxy) throws IOException { Log.debug("Opening Connection With: {{" + url + "}}"); HttpURLConnection connection; if (proxy == null) connection = (HttpURLConnection) url.openConnection(); else { connection = (HttpURLConnection) proxy.getConnection(url); } setConfiguration(connection); return connection; }
public static HttpURLConnection getConnection(String urlString, Proxy proxy) throws IOException { URL url = new URL(urlString); HttpURLConnection connection = getConnection(url, proxy); setConfiguration(connection); return connection; }