- Netty 提供了 Embedded 传输,用于测试
ChannelHandler,EmbeddedChannel提供了通过ChannelPipeline传播事件的简便方法。将入站/出站数据写入到EmbeddedChannel中,然后检查是否有数据到达了ChannelPipeline的尾端-
writeInbound:将入站消息写入EmbeddedChannel中 -
readInbound:从EmbeddedChannel中读取一个入站消息 -
writeOutbound:将出站消息写到EmbeddedChannel中 -
readOutbound:从EmbeddedChannel中读取一个出站消息 -
finish:将EmbeddedChannel标记为完成,如果有可悲读取的出/入站数据则返回true
image.png
示例见:Chapter9
-










网友评论