private HttpURLConnection openConnection ( URL url ) throws IOException { URLConnection urlConnection = url . openConnection ( ) ; if ( ! ( urlConnection instanceof HttpURLConnection ) ) { throw new IllegalStateException ( "Connection should be an HttpURLConnection" ) ; } return ( HttpURLConnection ) urlConnection ; }
Opens and returns a connection to the given URL .