I am integrating hoverfly as proxy server for my spring boot application. This application calls other REST APIs and I want to capture the request and response and later use that in simulate mode for further calls through hoverfly.
I am able to implement through below code and its working fine
Proxy proxy= new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8500));
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setProxy(proxy);
restTemplate.setRequestFactory(requestFactory);
But I am unable to run it with following JVM argument passed from command line at run time: -Dhttp.proxyHos127.0.0.1 -Dhttp.proxyPort=8500 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8500 -Dhttps.proxySet=true -Dhttp.proxySet=true
When I use these parameters, no proxy host is set and all requests are goes to actual server.
As I read on many forums that proxy configuration is possible through JVM argument. So, I am trying to use proxy server without changing any code.
Please suggest if its possible.