browsermob-proxy
browsermob-proxy copied to clipboard
BMP using chainedProxy failed with network error "ERR_EMPTY_RESPONSE"
It is under VPN network so I use API setChainedProxy to set upstream proxy . This method has been worked well before. But now failed with proxy error "ERR_EMPTY_RESPONSE". Could u check where is wrong with this API ? The proxy server isn’t responding • Check your proxy settings xx.xx.xx.xx:55060. Go to Tools > Internet Options > Connections. If you are on a LAN, click “LAN settings”. • Make sure your firewall settings aren’t blocking your web access. Ask your system administrator for help.
CertificateAndKeySource rootCertificateGenerator = RootCertificateGenerator.builder()
.keyGenerator(new ECKeyGenerator())
.build();
// tell the ImpersonatingMitmManager to generate EC keys and to use the EC RootCertificateGenerator
ImpersonatingMitmManager mitmManager = ImpersonatingMitmManager.builder()
.rootCertificateSource(rootCertificateGenerator)
.serverKeyGenerator(new ECKeyGenerator())
.build();
BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.setMitmManager(mitmManager);
proxy.setChainedProxy(new InetSocketAddress("proxy address", 8080));
proxy.setTrustAllServers(true);
proxy.start(0);
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
// configure it as a desired capability
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);
capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true);
capabilities.setCapability("ignoreProtectedModeSettings", true);
String driverPath=System.getProperty("user.dir")+"/IEDriverServer.exe";
System.setProperty("webdriver.ie.driver", driverPath);
WebDriver driver = new InternetExplorerDriver(capabilities);
proxy.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT);
// start the proxy
proxy.newHar("test.com");
driver.get("https://www.baidu.com/");