我是靠谱客的博主 紧张衬衫,这篇文章主要介绍Netty之ChannelInboundHandler的传播机制,现在分享给大家,希望可以做个参考。

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内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(117)

评论列表共有 0 条评论

立即
投稿
返回
顶部