@Override
    public byte[] serialize(Object obj) throws CodecException {
        ByteArrayOutputStream byteArray = localOutputByteArray.get();
        byteArray.reset();
        Hessian2Output output = new Hessian2Output(byteArray);
        output.setSerializerFactory(serializerFactory);
        try {
            output.writeObject(obj);
            output.close();
        } catch (IOException e) {
            throw new CodecException("IOException occurred when Hessian serializer encode!", e);
        }
        return byteArray.toByteArray();
    }
@see com.alipay.remoting.serialization.Serializer#serialize(java.lang.Object)
src/main/java/com/alipay/remoting/serialization/HessianSerializer.java