@Test
  public void testClosingResourcesMultipleTimes_noErrors()
      throws IOException, InterruptedException, GeneralSecurityException, URISyntaxException {
    FailoverHttpClient httpClient = new FailoverHttpClient(true /*insecure*/, false, logger);
    try (TestWebServer server = new TestWebServer(false, 2);
        Response ignored1 = httpClient.get(new URL(server.getEndpoint()), request);
        Response ignored2 = httpClient.get(new URL(server.getEndpoint()), request)) {
      ignored1.close();
      ignored2.close();
    } finally {

      // Validate that calling shutdown() many times completes with no errors
      assertThat(httpClient.getTransportsCreated()).hasSize(2);
      httpClient.shutDown();
      httpClient.shutDown();
      assertThat(httpClient.getTransportsCreated()).hasSize(0);
    }
  }
Tests for {@link FailoverHttpClient} using an actual local server.
jib-core/src/test/java/com/google/cloud/tools/jib/http/WithServerFailoverHttpClientTest.java