@Override
protected Object encode(ChannelHandlerContext ctx, Channel channel,
Object msg) throws Exception {
SerializationContextProvider contextProvider = new SerializationContextProvider();
AMFSerializer serializer = new AMFSerializer(contextProvider.get());
ByteArrayOutputStream baos = null;
try
{
baos = serializer.toAmf(msg);
}
catch (IOException e)
{
LOG.error("IO Error: {}",e);
throw e;