use of org.apache.mina.filter.codec.ProtocolEncoder in project camel by apache.
the class Mina2UdpProtocolCodecFactory method getEncoder.
public ProtocolEncoder getEncoder(IoSession session) throws Exception {
return new ProtocolEncoder() {
public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
IoBuffer buf = toIoBuffer(message);
buf.flip();
out.write(buf);
}
public void dispose(IoSession session) throws Exception {
// do nothing
}
};
}
use of org.apache.mina.filter.codec.ProtocolEncoder in project directory-ldap-api by apache.
the class AbstractCodecServiceTest method setupLdapCodecService.
/**
* Initialize the codec service
*/
@BeforeClass
public static void setupLdapCodecService() {
codec = new DefaultLdapCodecService();
codec.registerProtocolCodecFactory(new ProtocolCodecFactory() {
public ProtocolEncoder getEncoder(IoSession session) throws Exception {
return null;
}
public ProtocolDecoder getDecoder(IoSession session) throws Exception {
return null;
}
});
if (LdapApiServiceFactory.isInitialized() == false) {
LdapApiServiceFactory.initialize(codec);
}
encoder = new LdapEncoder(codec);
}
use of org.apache.mina.filter.codec.ProtocolEncoder in project camel by apache.
the class MinaUdpProtocolCodecFactory method getEncoder.
public ProtocolEncoder getEncoder() throws Exception {
return new ProtocolEncoder() {
public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
ByteBuffer buf = toByteBuffer(message);
buf.flip();
out.write(buf);
}
public void dispose(IoSession session) throws Exception {
// do nothing
}
};
}
Aggregations