ServiceFactory { public HttpClient createHttpClient(boolean useProxy, String proxyHost, int proxyPort) { ProxySettings proxySettings = ProxySettings.fromConfig(useProxy, proxyHost, proxyPort); return httpClients.computeIfAbsent(proxySettings, this::createHttpClient); } ServiceFactory();   ServiceFactory(HttpClientFactory httpClientFactory); static ObjectMapper getObjectMapper(); HttpClient createHttpClient(boolean useProxy, String proxyHost, int proxyPort);  }
@Test public void testDefaultHttpClientFactory() { ServiceFactory factory = new ServiceFactory(); HttpClient httpClient = factory.createHttpClient(false, null, 0); assertThat(httpClient.getClass().getSimpleName()).isEqualTo("HttpClientImpl"); }