Create HttpURLConnection wrapper and refactor