Added a template method to configure HttpURLConnection before its use