browsermob behind a corporate proxy

We were able to use browsermob behind a corporate proxy using the following code:

 

// start the proxy

server = new ProxyServer(9090);

server.start();

 

server.setCaptureContent(true);

server.setCaptureHeaders(true);

server.addHeader(“accept-encoding”, “”);

 

// Configure proxy server to use our network proxy

server.setLocalHost(InetAddress.getByName(“127.0.0.1”));

/**

* THIS IS THE MAJICK!

**/

HashMap<String, String> options = new HashMap<String, String>();

options.put(“httpProxy”, “172.20.4.115:8080”);

server.setOptions(options);

server.autoBasicAuthorization(“172.20.4.115”, “username”, “password”);

Leave a reply

Your email address will not be published. Required fields are marked *