@Test public void shouldAddProxyToClient() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException{ HttpClientBuilder builder = HttpClientBuilder.create(); ClientConfiguration config = new ClientConfiguration().withProxyHost("127.0.0.1").withProxyPort(8080); HttpClientSettings settings = HttpClientSettings.adapt(config); DefaultTokenManager.addProxyConfig(builder, settings); builder.build(); Field field = builder.getClass().getDeclaredField("routePlanner"); field.setAccessible(true); HttpRoutePlanner httpRoutePlanner = (HttpRoutePlanner) field.get(builder); assertNotNull(httpRoutePlanner); }
public static void addProxyConfig(HttpClientBuilder builder, HttpClientSettings settings) { if (settings.isProxyEnabled()) { log.info("Configuring Proxy. Proxy Host: " + settings.getProxyHost() + " " + "Proxy Port: " + settings.getProxyPort()); builder.setRoutePlanner(new SdkProxyRoutePlanner( settings.getProxyHost(), settings.getProxyPort(), settings.getNonProxyHosts())); if (settings.isAuthenticatedProxy()) { builder.setDefaultCredentialsProvider(ApacheUtils.newProxyCredentialsProvider(settings)); } } }
DefaultTokenManager implements TokenManager { public static void addProxyConfig(HttpClientBuilder builder, HttpClientSettings settings) { if (settings.isProxyEnabled()) { log.info("Configuring Proxy. Proxy Host: " + settings.getProxyHost() + " " + "Proxy Port: " + settings.getProxyPort()); builder.setRoutePlanner(new SdkProxyRoutePlanner( settings.getProxyHost(), settings.getProxyPort(), settings.getNonProxyHosts())); if (settings.isAuthenticatedProxy()) { builder.setDefaultCredentialsProvider(ApacheUtils.newProxyCredentialsProvider(settings)); } } } }
DefaultTokenManager implements TokenManager { public static void addProxyConfig(HttpClientBuilder builder, HttpClientSettings settings) { if (settings.isProxyEnabled()) { log.info("Configuring Proxy. Proxy Host: " + settings.getProxyHost() + " " + "Proxy Port: " + settings.getProxyPort()); builder.setRoutePlanner(new SdkProxyRoutePlanner( settings.getProxyHost(), settings.getProxyPort(), settings.getNonProxyHosts())); if (settings.isAuthenticatedProxy()) { builder.setDefaultCredentialsProvider(ApacheUtils.newProxyCredentialsProvider(settings)); } } } DefaultTokenManager(String apiKey);  DefaultTokenManager(TokenProvider provider); }
DefaultTokenManager implements TokenManager { public static void addProxyConfig(HttpClientBuilder builder, HttpClientSettings settings) { if (settings.isProxyEnabled()) { log.info("Configuring Proxy. Proxy Host: " + settings.getProxyHost() + " " + "Proxy Port: " + settings.getProxyPort()); builder.setRoutePlanner(new SdkProxyRoutePlanner( settings.getProxyHost(), settings.getProxyPort(), settings.getNonProxyHosts())); if (settings.isAuthenticatedProxy()) { builder.setDefaultCredentialsProvider(ApacheUtils.newProxyCredentialsProvider(settings)); } } } DefaultTokenManager(String apiKey);  DefaultTokenManager(TokenProvider provider); void setIamEndpoint(String iamEndpoint); void setIamRefreshOffset(double offset); void setIamMaxRetry(int count); TokenProvider getProvider(); @Override String getToken(); ClientConfiguration getClientConfiguration(); void setClientConfiguration(ClientConfiguration clientConfiguration); static void addProxyConfig(HttpClientBuilder builder,
			HttpClientSettings settings); }
DefaultTokenManager implements TokenManager { public static void addProxyConfig(HttpClientBuilder builder, HttpClientSettings settings) { if (settings.isProxyEnabled()) { log.info("Configuring Proxy. Proxy Host: " + settings.getProxyHost() + " " + "Proxy Port: " + settings.getProxyPort()); builder.setRoutePlanner(new SdkProxyRoutePlanner( settings.getProxyHost(), settings.getProxyPort(), settings.getNonProxyHosts())); if (settings.isAuthenticatedProxy()) { builder.setDefaultCredentialsProvider(ApacheUtils.newProxyCredentialsProvider(settings)); } } } DefaultTokenManager(String apiKey);  DefaultTokenManager(TokenProvider provider); void setIamEndpoint(String iamEndpoint); void setIamRefreshOffset(double offset); void setIamMaxRetry(int count); TokenProvider getProvider(); @Override String getToken(); ClientConfiguration getClientConfiguration(); void setClientConfiguration(ClientConfiguration clientConfiguration); static void addProxyConfig(HttpClientBuilder builder,
			HttpClientSettings settings);  }