Here you can find the source of getConnection(URL url)
private static HttpURLConnection getConnection(URL url) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; public class Main { private static HttpURLConnection getConnection(URL url) throws IOException { HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setDoInput(true);/*from www .j av a 2 s . com*/ conn.setDoOutput(true); conn.setRequestProperty("Accept", "application/zip;text/html"); return conn; } }