问题
I started seeing below issue recently when i run my tests on chrome browser(selenium)
io.netty.handler.codec.TooLongFrameException: HTTP content length exceeded 2097152 bytes. at io.netty.handler.codec.http.HttpObjectAggregator.decode(HttpObjectAggregator.java:241) ~[netty-all-4.0.42.Final.jar:4.0.42.Final] at io.netty.handler.codec.http.HttpObjectAggregator.decode(HttpObjectAggregator.java:89) ~[netty-all-4.0.42.Final.jar:4.0.42.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) [netty-all-4.0.42.Final.jar:4.0.42.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367) [netty-all-4.0.42.Final.jar:4.0.42.Final]
private DesiredCapabilities getDesiredCapabilitiesForSeleniumProxy() {
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
server = new BrowserMobProxyServer();
server.setTrustAllServers(true);
server.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT);
server.start();
server.addResponseFilter((response, content, info) -> {
if (info.getOriginalUrl().endsWith("imports")) {
try {
Id = parseJsonData(content.getTextContents());
JobId = getExternalJobId(content.getTextContents());
} catch (JSONException e) {
}
}
});
Proxy proxy = ClientUtil.createSeleniumProxy(server);
capabilities.setCapability(CapabilityType.PROXY, proxy);
return capabilities;
}
when i google, i got this below code. how can i add/use in my code. please help
server.addFirstHttpFilterFactory(new RequestFilterAdapter.FilterSource(filter, 16777216));
来源:https://stackoverflow.com/questions/43813715/io-netty-handler-codec-toolongframeexception-http-content-length-exceeded-20971