Here you can find the source of createConnection(URL url)
private static URLConnection createConnection(URL url) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.net.URL; import java.net.URLConnection; public class Main { private static URLConnection createConnection(URL url) throws IOException { URLConnection con = url.openConnection(); con.addRequestProperty("Protocol", "HTTP/1.1"); con.addRequestProperty("Connection", "keep-alive"); con.addRequestProperty("Keep-Alive", "200"); con.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1"); return con; }/* w w w .j ava 2s .com*/ }