@Test
    public void testCustomThrowableDeserializerEnabled() throws Exception {
        setGenericThrowException(true);
        try {
            GenericSingleClassLoaderSofaSerializerFactory factory = new GenericSingleClassLoaderSofaSerializerFactory();

            ByteArrayOutputStream bsOut = new ByteArrayOutputStream();
            Hessian2Output hessian2Output = new Hessian2Output(bsOut);
            hessian2Output.setSerializerFactory(factory);

            MockError mockError = new MockError("MockError");
            hessian2Output.writeObject(mockError);
            hessian2Output.flush();

            Deserializer javaDeserializer = factory.getDeserializer(MockError.class.getName());
            Assert.assertTrue(javaDeserializer instanceof JavaDeserializer);

            ByteArrayInputStream bsIn = new ByteArrayInputStream(bsOut.toByteArray());
            Hessian2Input hessian2Input = new Hessian2Input(bsIn);
            hessian2Input.setSerializerFactory(factory);
            Object result = hessian2Input.readObject();
            Assert.assertTrue(result instanceof MockError);
            Assert.assertEquals("MockError", ((MockError) result).getMessage());
        } finally {
            setGenericThrowException(false);
            clearCacheDeserializerMap();
        }
    }
@author <a href="mailto:zhanggeng.zg@antfin.com">GengZhang</a>
codec/codec-sofa-hessian/src/test/java/com/alipay/sofa/rpc/codec/sofahessian/GenericSingleClassLoaderSofaSerializerFactoryTest.java