@Test public void testEncode2() throws Exception { Object o = new Object(); HessianEncoder hessianEncoder = new HessianEncoder(); Assert.assertEquals(o,hessianEncoder.encode(null, null, o)); }
@Override protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (msg instanceof Message) { ByteArrayOutputStream bos = new ByteArrayOutputStream(1024); Hessian2Output h2o = new Hessian2Output(bos); h2o.setSerializerFactory(factory); h2o.writeObject(msg); h2o.flush(); byte[] content = bos.toByteArray(); return ChannelBuffers.wrappedBuffer(content); } return msg; }
HessianEncoder extends OneToOneEncoder { @Override protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (msg instanceof Message) { ByteArrayOutputStream bos = new ByteArrayOutputStream(1024); Hessian2Output h2o = new Hessian2Output(bos); h2o.setSerializerFactory(factory); h2o.writeObject(msg); h2o.flush(); byte[] content = bos.toByteArray(); return ChannelBuffers.wrappedBuffer(content); } return msg; } }
HessianEncoder extends OneToOneEncoder { @Override protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (msg instanceof Message) { ByteArrayOutputStream bos = new ByteArrayOutputStream(1024); Hessian2Output h2o = new Hessian2Output(bos); h2o.setSerializerFactory(factory); h2o.writeObject(msg); h2o.flush(); byte[] content = bos.toByteArray(); return ChannelBuffers.wrappedBuffer(content); } return msg; } HessianEncoder(); }
HessianEncoder extends OneToOneEncoder { @Override protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (msg instanceof Message) { ByteArrayOutputStream bos = new ByteArrayOutputStream(1024); Hessian2Output h2o = new Hessian2Output(bos); h2o.setSerializerFactory(factory); h2o.writeObject(msg); h2o.flush(); byte[] content = bos.toByteArray(); return ChannelBuffers.wrappedBuffer(content); } return msg; } HessianEncoder();  }
HessianEncoder extends OneToOneEncoder { @Override protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (msg instanceof Message) { ByteArrayOutputStream bos = new ByteArrayOutputStream(1024); Hessian2Output h2o = new Hessian2Output(bos); h2o.setSerializerFactory(factory); h2o.writeObject(msg); h2o.flush(); byte[] content = bos.toByteArray(); return ChannelBuffers.wrappedBuffer(content); } return msg; } HessianEncoder();   }