标签:
package com.server; import java.net.InetSocketAddress; import java.nio.charset.Charset; import org.apache.mina.core.service.IoAcceptor; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.filter.executor.ExecutorFilter; import org.apache.mina.transport.socket.nio.NioSocketAcceptor; import com.decode.DataObjectDecoder; import com.encode.DataObjectEncode; public class MinaServer { public final static int PORT = 9100; public final static void init() { Charset charset = Charset.forName("utf-8"); IoAcceptor acceptor = new NioSocketAcceptor(); try { acceptor.getFilterChain().addLast("codec",new ProtocolCodecFilter(new DataObjectEncode(charset),new DataObjectDecoder(charset))); acceptor.getFilterChain().addLast("exceutor", new ExecutorFilter()); acceptor.setHandler(new MinaServerHandler()); acceptor.bind( new InetSocketAddress(PORT)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String[] args) { MinaServer.init(); } }
mina2.0.9 netty4.0.25 编码和解码 性能测试
标签:
原文地址:http://my.oschina.net/huaye2007/blog/377543