private HttpURLConnection prepareConnection ( Map < String , String > extraHeaders ) throws IOException { // create URLConnection HttpURLConnection connection = ( HttpURLConnection ) serviceUrl . openConnection ( connectionProxy ) ; connection . setConnectTimeout ( connectionTimeoutMillis ) ; connection . setReadTimeout ( readTimeoutMillis ) ; connection . setAllowUserInteraction ( false ) ; connection . setDefaultUseCaches ( false ) ; connection . setDoInput ( true ) ; connection . setDoOutput ( true ) ; connection . setUseCaches ( false ) ; connection . setInstanceFollowRedirects ( true ) ; connection . setRequestMethod ( "POST" ) ; setupSsl ( connection ) ; addHeaders ( extraHeaders , connection ) ; return connection ; }
Prepares a connection to the server .