@Test
  public void testProxyCredentialProperties()
      throws IOException, InterruptedException, GeneralSecurityException, URISyntaxException {
    String proxyResponse =
        "HTTP/1.1 407 Proxy Authentication Required\n"
            + "Proxy-Authenticate: BASIC realm=\"some-realm\"\n"
            + "Cache-Control: no-cache\n"
            + "Pragma: no-cache\n"
            + "Content-Length: 0\n\n";
    String targetServerResponse = "HTTP/1.1 200 OK\nContent-Length:12\n\nHello World!";

    FailoverHttpClient httpClient = new FailoverHttpClient(true /*insecure*/, false, logger);
    try (TestWebServer server =
        new TestWebServer(false, Arrays.asList(proxyResponse, targetServerResponse), 1)) {
      System.setProperty("http.proxyHost", "localhost");
      System.setProperty("http.proxyPort", String.valueOf(server.getLocalPort()));
      System.setProperty("http.proxyUser", "user_sys_prop");
      System.setProperty("http.proxyPassword", "pass_sys_prop");

      try (Response response = httpClient.get(new URL("http://does.not.matter"), request)) {
        MatcherAssert.assertThat(
            server.getInputRead(),
            CoreMatchers.containsString(
                "Proxy-Authorization: Basic dXNlcl9zeXNfcHJvcDpwYXNzX3N5c19wcm9w"));
        Assert.assertArrayEquals(
            "Hello World!".getBytes(StandardCharsets.UTF_8),
            ByteStreams.toByteArray(response.getBody()));
      }
    }
  }
Tests for {@link FailoverHttpClient} using an actual local server.
jib-core/src/test/java/com/google/cloud/tools/jib/http/WithServerFailoverHttpClientTest.java