Here you can find the source of openConnection(final String urlString)
private static HttpURLConnection openConnection(final String urlString) throws Exception
//package com.java2s; //License from project: Apache License import java.net.HttpURLConnection; import java.net.URL; public class Main { private static HttpURLConnection openConnection(final String urlString) throws Exception { final URL url = new URL(urlString); final HttpURLConnection connection = (HttpURLConnection) url.openConnection(); return connection; }//from w w w. ja v a 2s . co m }