@VisibleForTesting protected HttpURLConnection createConnection() throws RequestFailureException {
  try {
    URL url=new URL(mGenerator.getServerUrl());
    HttpURLConnection connection=(HttpURLConnection)url.openConnection();
    connection.setConnectTimeout(MS_CONNECTION_TIMEOUT);
    connection.setReadTimeout(MS_CONNECTION_TIMEOUT);
    return connection;
  }
 catch (  MalformedURLException e) {
    throw new RequestFailureException("Caught a malformed URL exception.",e);
  }
catch (  IOException e) {
    throw new RequestFailureException("Failed to open connection to URL",e);
  }
}

@ VisibleForTesting protected HttpURLConnection createConnection ( ) throws RequestFailureException { try { URL url = new URL ( mGenerator . getServerUrl ( ) ) ; HttpURLConnection connection = ( HttpURLConnection ) url . openConnection ( ) ; connection . setConnectTimeout ( MS_CONNECTION_TIMEOUT ) ; connection . setReadTimeout ( MS_CONNECTION_TIMEOUT ) ; return connection ; } catch ( MalformedURLException e ) { throw new RequestFailureException ( "Caught a malformed URL exception." , e ) ; } catch ( IOException e ) { throw new RequestFailureException ( "Failed to open connection to URL" , e ) ; } }
returns a httpurlconnection to the server .
