1、关于ChannelInboundHandler,我们用channelRead()作例子,来体验一下Inbound事件的传播。我们在服务端的Pipeline添加3个ChannelInboundHandler
netty Server
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();
最后
以上就是紧张衬衫最近收集整理的关于Netty之ChannelInboundHandler的传播机制的全部内容,更多相关Netty之ChannelInboundHandler内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复