1、具体的解码器,编码器需要自己根据协议实现
2、实现协议编码解码器工厂ProtocolCodecFactory接口,在里面主要的工作就是创建解码器,编码器实例,并且返回实例
下面贴出三个接口的源码,读者只需要实现这三个接口即可
package org.apache.mina.filter.codec;
import org.apache.mina.core.session.IoSession;
/**
* Provides {@link ProtocolEncoder} and {@link ProtocolDecoder} which translates
* binary or protocol specific data into message object and vice versa.
* <p>负责创建编码和解码器
* Please refer to参见ReverserProtocolProvider类的实现
* <a href="/xref-examples/org/apache/mina/examples/reverser/ReverseProtocolProvider.html">
* <code>ReverserProtocolProvider</code></a>
* example.
*
*/
public interface ProtocolCodecFactory {
/*