Here you can find the source of getHttpConnection(Proxy prx, URL u, int millis)
public static HttpURLConnection getHttpConnection(Proxy prx, URL u, int millis) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.net.HttpURLConnection; import java.net.Proxy; import java.net.URL; public class Main { public static String C_ENC = "UTF-8"; public static HttpURLConnection getHttpConnection(Proxy prx, URL u, int millis) throws IOException { HttpURLConnection h = null; h = (prx != null) ? (HttpURLConnection) u.openConnection(prx) : (HttpURLConnection) u.openConnection(); h.setDoOutput(true);//from w ww . jav a 2s . co m h.setUseCaches(false); h.setDoInput(true); h.setAllowUserInteraction(false); h.setRequestProperty("Accept-Charset", C_ENC); h.setConnectTimeout(millis); return h; } }