mina2.0.9 netty4.0.25 编码和解码 性能测试
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(); } }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。