Here you can find the source of openConnection(URL url, Proxy proxy)
static HttpURLConnection openConnection(URL url, Proxy proxy) throws IOException
//package com.java2s; /*/*from w ww. j a v a 2s. c o m*/ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.io.*; import java.net.HttpURLConnection; import java.net.Proxy; import java.net.URL; public class Main { static HttpURLConnection openConnection(URL url, Proxy proxy) throws IOException { HttpURLConnection result = (HttpURLConnection) url.openConnection(proxy); result.setConnectTimeout(15000); result.setReadTimeout(15000); result.setUseCaches(false); return result; } }