1、关于ChannelOutboundHandler,我们用write()作例子,来体验一下Outbound事件的传播。
我们继续在服务端的Pipeline添加3个ChannelOutboundHandler
package com.example.demo.http;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpServerCodec;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class NettyTestServer {
/**
* host
*/
private final static String host = "0.0.0.0";
/**
* 端口号
*/
private final static Integer port = 8085;
public static void main(String[] args) {
start();
}
/**