use of io.netty.channel.ChannelPipeline in project flink by apache.
the class RouterHandler method routed.
private void routed(ChannelHandlerContext channelHandlerContext, RouteResult<?> routeResult, HttpRequest httpRequest) {
ChannelInboundHandler handler = (ChannelInboundHandler) routeResult.target();
// The handler may have been added (keep alive)
ChannelPipeline pipeline = channelHandlerContext.pipeline();
ChannelHandler addedHandler = pipeline.get(ROUTED_HANDLER_NAME);
if (handler != addedHandler) {
if (addedHandler == null) {
pipeline.addAfter(ROUTER_HANDLER_NAME, ROUTED_HANDLER_NAME, handler);
} else {
pipeline.replace(addedHandler, ROUTED_HANDLER_NAME, handler);
}
}
RoutedRequest<?> request = new RoutedRequest<>(routeResult, httpRequest);
channelHandlerContext.fireChannelRead(request.retain());
}
use of io.netty.channel.ChannelPipeline in project netty-socketio by mrniko.
the class SocketIOChannelInitializer method initChannel.
@Override
protected void initChannel(Channel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
addSslHandler(pipeline);
addSocketioHandlers(pipeline);
}
use of io.netty.channel.ChannelPipeline in project netty by netty.
the class Socks4ProxyHandler method addCodec.
@Override
protected void addCodec(ChannelHandlerContext ctx) throws Exception {
ChannelPipeline p = ctx.pipeline();
String name = ctx.name();
Socks4ClientDecoder decoder = new Socks4ClientDecoder();
p.addBefore(name, null, decoder);
decoderName = p.context(decoder).name();
encoderName = decoderName + ".encoder";
p.addBefore(name, encoderName, Socks4ClientEncoder.INSTANCE);
}
use of io.netty.channel.ChannelPipeline in project netty by netty.
the class Socks4ProxyServer method configure.
@Override
protected void configure(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
switch(testMode) {
case INTERMEDIARY:
p.addLast(new Socks4ServerDecoder());
p.addLast(Socks4ServerEncoder.INSTANCE);
p.addLast(new Socks4IntermediaryHandler());
break;
case TERMINAL:
p.addLast(new Socks4ServerDecoder());
p.addLast(Socks4ServerEncoder.INSTANCE);
p.addLast(new Socks4TerminalHandler());
break;
case UNRESPONSIVE:
p.addLast(UnresponsiveHandler.INSTANCE);
break;
}
}
use of io.netty.channel.ChannelPipeline in project netty by netty.
the class HttpProxyServer method configure.
@Override
protected void configure(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
switch(testMode) {
case INTERMEDIARY:
p.addLast(new HttpServerCodec());
p.addLast(new HttpObjectAggregator(1));
p.addLast(new HttpIntermediaryHandler());
break;
case TERMINAL:
p.addLast(new HttpServerCodec());
p.addLast(new HttpObjectAggregator(1));
p.addLast(new HttpTerminalHandler());
break;
case UNRESPONSIVE:
p.addLast(UnresponsiveHandler.INSTANCE);
break;
}
}
Aggregations