34158 [LittleProxy-0-ClientToProxyWorker-4] INFO org.littleshoot.proxy.impl.ClientToProxyConnection - (AWAITING_INITIAL) [id: 0xa3546419, L:/fe80:0:0:0:914d:bb9c:f458:c88f%13:21471 - R:/fe80:0:0:0:914d:bb9c:f458:c88f%13:21503]: An IOException occurred on ClientToProxyConnection: An existing connection was forcibly closed by the remote host
System.setProperty("bmp.allowNativeDnsFallback", "true");
// start the proxy
BrowserMobProxy proxy = new BrowserMobProxyServer();
// https://github.com/lightbody/browsermob-proxy/tree/master/mitm
proxy.setMitmManager(ImpersonatingMitmManager.builder().trustAllServers(true).build());
Thank you in advance.
I have been unsuccessfully trying to get the embedded browsermob proxy to work for SSL requests in a chained proxy environment.
This site in this code works for Chrome and Firefox, but I only get a partial .har file with IE and errors like this:
34158 [LittleProxy-0- ClientToProxyWorker-4] INFO org.littleshoot.proxy.impl. ClientToProxyConnection - (AWAITING_INITIAL) [id: 0xa3546419, L:/fe80:0:0:0:914d:bb9c:f458: c88f%13:21471 - R:/fe80:0:0:0:914d:bb9c:f458: c88f%13:21503]: An IOException occurred on ClientToProxyConnection: An existing connection was forcibly closed by the remote host
In order to get this to work I did import into IE the ca-certificate.rsa.cer file that was posted here in the SSL support info:
https://github.com/lightbody/browsermob-proxyHere is my pom.xml dependency:
<dependency>
<groupId>net.lightbody.bmp< /groupId>
<artifactId>browsermob- core</artifactId>
<version>2.1.1</version>
</dependency>
And here is sample code:
System.setProperty("bmp. allowNativeDnsFallback", "true");
// start the proxy
BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.setChainedProxy(new InetSocketAddress("aaaa.bcde. com", 80));
proxy.setTrustAllServers( true);// https://github.com/lightbody/browsermob-proxy/tree/master/mitm
proxy.setMitmManager( ImpersonatingMitmManager. builder().trustAllServers( true).build());proxy.start();// get the Selenium proxy object
Proxy seleniumProxy = ClientUtil. createSeleniumProxy(proxy);// configure it as a desired capability
DesiredCapabilities capabilities = new DesiredCapabilities();
// IE ONLY
capabilities.setCapability( InternetExplorerDriver. INTRODUCE_FLAKINESS_BY_ IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability(" ignoreZoomSetting", true);
// Keep the proxy settings from being overwritten
capabilities.setCapability( InternetExplorerDriver.IE_USE_ PRE_PROCESS_PROXY, true);
capabilities.setCapability( InternetExplorerDriver. UNEXPECTED_ALERT_BEHAVIOR, "accept");
// END IE ONLY
capabilities.setCapability( CapabilityType.PROXY, seleniumProxy);
// start the browser up
//WebDriver driver = new FirefoxDriver(capabilities);
//WebDriver driver = new ChromeDriver(capabilities);
WebDriver driver = new InternetExplorerDriver( capabilities);
driver.manage().timeouts(). pageLoadTimeout(45, TimeUnit.SECONDS);
proxy.enableHarCaptureTypes( CaptureType.RESPONSE_CONTENT);
proxy.newHar("boa");try {
driver.get("https://www.bankofamerica.com/");
} catch (TimeoutException ex) {
// keep going
}
// End of sample codeCan anyone tell me what I am missing?Thank you in advance.