### Question:
UrlHttpClient implements HttpClient { @SuppressWarnings("checkstyle:emptyblock") HttpResponse createHttpResponse(final HttpRequest request, final HttpURLConnection connection) throws IOException { final String statusText = connection.getResponseMessage(); final int statusCode = connection.getResponseCode(); InputStream content = connection.getErrorStream(); if (content == null) { if (!"HEAD".equals(request.getMethod())) { try { content = connection.getInputStream(); } catch (final IOException ioe) { } } } final HttpResponse.Builder builder = HttpResponse.builder() .statusCode(statusCode) .statusText(statusText) .content(content); for (final Map.Entry<String, List<String>> header : connection.getHeaderFields().entrySet()) { if (header.getKey() == null) { continue; } builder.header(header.getKey(), header.getValue().get(0)); } return builder.build(); } UrlHttpClient(ClientConfiguration config); @Override HttpResponse execute(final HttpRequest request); @Override void shutdown();  }### Answer:
@Test public void testCreateResponse() throws URISyntaxException, IOException { final HttpRequest request = new HttpRequest("PUT", new URI("https: final MockHttpURLConnection conn = new MockHttpURLConnection(new URL("https: final Map<String, List<String>> headerFields = new HashMap<String, List<String>>(); final List<String> header1 = new ArrayList<String>(); header1.add("value1"); header1.add("ExtraValue"); headerFields.put("key1", header1); final List<String> header2 = new ArrayList<String>(); header2.add("value2"); headerFields.put("key2", header2); final List<String> nullHeader = new ArrayList<String>(); headerFields.put(null, nullHeader); conn.setHeaderFields(headerFields); conn.setResponseCode(200); conn.setErrorStream(null); final ByteArrayInputStream bais = new ByteArrayInputStream("test".getBytes(StringUtils.UTF8)); conn.setInputStream(bais); conn.setResponseMessage("TestMessage"); final HttpResponse response = client.createHttpResponse(request, conn); assertEquals(response.getHeaders().get("key1"), "value1"); assertEquals(response.getHeaders().get("key2"), "value2"); assertEquals(response.getHeaders().size(), 2); assertEquals(response.getStatusCode(), 200); assertEquals(response.getStatusText(), "TestMessage"); assertSame(response.getContent(), bais); }