Implemented HTTP connection wrapping, so that we can substitute
HttpURLConnection with a test case fake connection.