Here you can find the source of createConnection(final String uri, final String authValue)
public static HttpURLConnection createConnection(final String uri, final String authValue) throws Exception
//package com.java2s; //License from project: Apache License import java.net.HttpURLConnection; import java.net.URL; public class Main { public static HttpURLConnection createConnection(final String uri, final String authValue) throws Exception { final URL url = new URL(uri); final HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setConnectTimeout(0); connection.setReadTimeout(0);/*from ww w .j av a 2 s . c om*/ connection.setRequestMethod("GET"); connection.setRequestProperty("Authorization", authValue); connection.setDoOutput(true); return connection; } }