RestTemplate with proxy - how to test

Viewed 73

I have this piece of code:

HttpRoutePlanner routePlanner = new SystemDefaultRoutePlanner(new MyProxySelector());

HttpComponentsClientHttpRequestFactory clientHttpRequestFactory 
    = new HttpComponentsClientHttpRequestFactory(
        HttpClientBuilder.create()
            .setProxy(new HttpHost(proxyUrl, port))
            .build());
restTemplate = new RestTemplate(clientHttpRequestFactory);

How can I create a test class to verify that the restTemplate is using the actual proxy?

Best regards.

0 Answers
Related