use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpObjectAggregator in project rskj by rsksmart.
the class Web3WebSocketServer method start.
@Override
public void start() {
logger.info("RPC WebSocket enabled");
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).childHandler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
p.addLast(new HttpServerCodec());
p.addLast(new HttpObjectAggregator(maxAggregatedFrameSize));
p.addLast(new WriteTimeoutHandler(serverWriteTimeoutSeconds, TimeUnit.SECONDS));
p.addLast(new RskWebSocketServerProtocolHandler("/websocket", maxFrameSize));
p.addLast(new WebSocketFrameAggregator(maxAggregatedFrameSize));
p.addLast(webSocketJsonRpcHandler);
p.addLast(web3ServerHandler);
p.addLast(new Web3ResultWebSocketResponseHandler());
}
});
webSocketChannel = b.bind(host, port);
try {
webSocketChannel.sync();
} catch (InterruptedException e) {
logger.error("The RPC WebSocket server couldn't be started", e);
Thread.currentThread().interrupt();
}
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpObjectAggregator in project ambry by linkedin.
the class Http2BlockingChannelStreamChannelInitializer method initChannel.
@Override
protected void initChannel(Channel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
p.addLast(http2StreamFrameToHttpObjectCodec);
p.addLast(new HttpObjectAggregator(http2ClientConfig.http2MaxContentLength));
p.addLast(http2BlockingChannelResponseHandler);
p.addLast(ambrySendToHttp2Adaptor);
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpObjectAggregator in project ambry by linkedin.
the class Http2ServerStreamHandler method handlerAdded.
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
ctx.pipeline().addLast(http2StreamFrameToHttpObjectCodec);
ctx.pipeline().addLast(new HttpObjectAggregator(http2ClientConfig.http2MaxContentLength));
ctx.pipeline().addLast(ambryNetworkRequestHandler);
ctx.pipeline().addLast(ambrySendToHttp2Adaptor);
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpObjectAggregator in project weicoder by wdcode.
the class WebSocketServer method handler.
@Override
protected ChannelHandler handler() {
return new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(final SocketChannel ch) throws Exception {
ch.pipeline().addLast(new HttpServerCodec());
ch.pipeline().addLast(new HttpObjectAggregator(1024 * 1024));
ch.pipeline().addLast(new WebSocketHandler("websocket"));
ch.config().setAllocator(PooledByteBufAllocator.DEFAULT);
}
};
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpObjectAggregator in project rest.li by linkedin.
the class TestRAPClientCodec method testDecodeException.
@Test
public void testDecodeException() {
final EmbeddedChannel ch = new EmbeddedChannel(new HttpClientCodec(), new HttpObjectAggregator(65536), new RAPClientCodec());
// When we received an invalid message, a decode exception should be thrown out of the
// end of netty pipeline.
String junk = "Not a HTTP message\r\n";
try {
ch.writeInbound(Unpooled.copiedBuffer(junk, CHARSET));
Assert.fail("Should have thrown decode exception");
} catch (Exception ex) {
// expected.
}
ch.finish();
}
Aggregations