### Question:
ConnectionUtils { public HttpURLConnection connectToEndpoint(URI endpoint, Map<String, String> headers) throws IOException { return connectToEndpoint(endpoint, headers, "GET"); } private  ConnectionUtils(); static ConnectionUtils getInstance(); HttpURLConnection connectToEndpoint(URI endpoint, Map<String, String> headers); HttpURLConnection connectToEndpoint(URI endpoint, Map<String, String> headers, String method);  }### Answer:
@Ignore @Test public void headersArePassedAsPartOfRequest() throws IOException { HttpURLConnection connection = sut.connectToEndpoint(URI.create("http: connection.getResponseCode(); mockServer.verify(getRequestedFor(urlMatching("/")).withHeader("HeaderA", equalTo("ValueA"))); }
@Test public void proxiesAreNotUsedEvenIfPropertyIsSet() throws IOException { System.getProperties().put("http.proxyHost", "localhost"); System.getProperties().put("http.proxyPort", String.valueOf(mockProxyServer.port())); HttpURLConnection connection = sut.connectToEndpoint(URI.create("http: assertThat(connection.getRequestMethod(), is("GET")); assertThat(connection.usingProxy(), is(false)); }
@Test public void headersArePassedAsPartOfRequest() throws IOException { HttpURLConnection connection = sut.connectToEndpoint(URI.create("http: connection.getResponseCode(); mockServer.verify(getRequestedFor(urlMatching("/")).withHeader("HeaderA", equalTo("ValueA"))); }