资 源 简 介
轻量级的NIO框架:
提供线程池的配置,异步读写
提供可扩展的编解码功能,实现了的serialization和textline
提供类似servlet的filter功能
提供SSL加密协议的功能
JMX动态监控系统的功能
使用简单,跟mina类似
性能好
Sample: echo服务器
```
public class EchoServer {
public static void main(String[] args) throws Exception {
NioServer server = new NioServer();
server.getReader().setCorePoolSize(2);
server.getTaskExecutor().setCorePoolSize(2);
server.getWriteExecutor().setCorePoolSize(4);
server.setIoHandle(new EchoIoHandler());
server.getIoFilterChain().addLast("codec", new CodecFilter(new TextLineCodecFactory("GBK")));
server.bind(new InetSocketAddress(9000));
}
}
public class EchoIoHandler extends IoHandlerAdapter {
@Override
public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
cause.printStackTrace();
}
@Override
public void messageReceived(IoSession ses