设为首页 加入收藏

TOP

Netty使用实例(二)
2014-11-24 02:50:53 来源: 作者: 【 】 浏览:5
Tags:Netty 使用 实例
ine() {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("decoder", new StringDecoder());
pipeline.addLast("encoder", new StringEncoder());
pipeline.addLast("handler", new HelloWorldClientHandler());
return pipeline;
}
});
//创建无连接传输channel的辅助类(UDP),包括client和server
ChannelFuture future = bootstrap.connect(new InetSocketAddress(
"localhost", 8080));
future.getChannel().getCloseFuture().awaitUninterruptibly();
bootstrap.releaseExternalResources();
}


@Test
public void testNetty(){
testServer();
testClient();
}


}


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Netty源码学习笔记 下一篇运用Spring注解实现Netty服务器端..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: