@Test
  public void testCall_secureCallerOnUnverifiableServer() throws IOException, RegistryException {
    Mockito.when(mockHttpClient.call(Mockito.any(), Mockito.any(), Mockito.any()))
        .thenThrow(Mockito.mock(SSLPeerUnverifiedException.class));

    try {
      endpointCaller.call();
      Assert.fail("Should throw InsecureRegistryException when getting SSLException");
    } catch (InsecureRegistryException ex) {
      Assert.assertEquals(
          "Failed to verify the server at https://serverUrl/v2/api because only secure connections "
              + "are allowed.",
          ex.getMessage());
    }
  }
Implementation of {@link RegistryEndpointProvider} for testing.
jib-core/src/test/java/com/google/cloud/tools/jib/registry/RegistryEndpointCallerTest.java