@Test
  public void testInsecureConnection_insecureHttpsFailover()
      throws IOException, InterruptedException, GeneralSecurityException, URISyntaxException {
    FailoverHttpClient insecureHttpClient =
        new FailoverHttpClient(true /*insecure*/, false, logger);
    try (TestWebServer server = new TestWebServer(true, 2);
        Response response = insecureHttpClient.get(new URL(server.getEndpoint()), request)) {

      Assert.assertEquals(200, response.getStatusCode());
      Assert.assertArrayEquals(
          "Hello World!".getBytes(StandardCharsets.UTF_8),
          ByteStreams.toByteArray(response.getBody()));

      String endpoint = server.getEndpoint();
      String expectedLog =
          "Cannot verify server at " + endpoint + ". Attempting again with no TLS verification.";
      Mockito.verify(logger).accept(LogEvent.warn(expectedLog));
    }
  }
Tests for {@link FailoverHttpClient} using an actual local server.
jib-core/src/test/java/com/google/cloud/tools/jib/http/WithServerFailoverHttpClientTest.java