package com.pingan.emall.biz.communication.handler;
import java.nio.charset.Charset;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;
/**
* Fund mid protocol codec factory
*
* @author LICHAO844
*
*/
public class FundTradeProtocolCodecFactory implements ProtocolCodecFactory {
public FundTradeProtocolCodecFactory() {
this(Charset.defaultCharset());
}
public FundTradeProtocolCodecFactory(Charset charset) {
encoder = new FundTradeProtocolEncoder(charset);
decoder = new FundTradeProtocolDecoder(charset);
}
@Override
public ProtocolDecoder getDecoder(IoSession iosession) throws Exception {
return decoder;
}
@Override
public ProtocolEncoder getEncoder(IoSession iosession) throws Exception {
return encoder;
}
private final FundTradeProtocolDecoder decoder;
private final FundTradeProtocolEncoder encoder;
}
import java.nio.charset.Charset;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;
/**
* Fund mid protocol codec factory
*
* @author LICHAO844
*
*/
public class FundTradeProtocolCodecFactory implements ProtocolCodecFactory {
public FundTradeProtocolCodecFactory() {
this(Charset.defaultCharset());
}
public FundTradeProtocolCodecFactory(Charset charset) {
encoder = new FundTradeProtocolEncoder(charset);
decoder = new FundTradeProtocolDecoder(charset);
}
@Override
public ProtocolDecoder getDecoder(IoSession iosession) throws Exception {
return decoder;
}
@Override
public ProtocolEncoder getEncoder(IoSession iosession) throws Exception {
return encoder;
}
private final FundTradeProtocolDecoder decoder;
private final FundTradeProtocolEncoder encoder;
}