### Question:
Http { public Response get(String url, Map<String, String> headers, boolean allowRedirect) throws Exception { HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection(); InputStream in = null; setCommonProperties(headers, urlConnection, allowRedirect); try { in = readInputStream(urlConnection); } catch (Exception e) { throw e; } finally { urlConnection.disconnect(); } return new Response(urlConnection.getResponseCode(), in, urlConnection.getHeaderFields()); }  static void initCookieManager(Context context); static void clearCookie(Context context); Response get(String url, Map<String, String> headers, boolean allowRedirect); Response post(String url, Map<String, String> headers, HttpEntity httpEntity, boolean allowRedirect); static byte[] unGZIP(byte[] zipped); static ByteArrayInputStream readDataForZgip(InputStream inStream, String charsetName); static ByteArrayInputStream read(InputStream inStream, String charsetName);  }### Answer:
@Test public void shouldReturnCorrectResponse() throws Exception { server.enqueue(new MockResponse().setBody("it's all cool")); server.play(); Http.Response response = http.get(server.getUrl("/").toString(), new HashMap<String, String>(), false); assertThat(fromStream(response.getResponseBody()), equalTo("it's all cool")); }
@Test public void testHttpClientCanReadHttpErrorResp() throws Exception { server.enqueue(new MockResponse().setBody("Forbidden") .setResponseCode(403)); server.play(); Http.Response response = http.get(server.getUrl("/").toString(), new HashMap<String, String>(), false); assertThat(fromStream(response.getResponseBody()), equalTo("Forbidden")); }