protected SofaRpcException buildDeserializeError(String message) {
        return new SofaRpcException(getErrorCode(false), LogCodes.getLog(LogCodes.ERROR_SERIALIZER, message));
    }
@Test
    public void buildDeserializeError() {
        RpcInternalContext old = RpcInternalContext.peekContext();
        try {
            RpcInternalContext.removeContext();
            SofaRpcException exception = serializer.buildDeserializeError("xx");
            Assert.assertEquals(RpcErrorType.UNKNOWN, exception.getErrorType());

            RpcInternalContext.getContext().setProviderSide(true);
            exception = serializer.buildDeserializeError("xx");
            Assert.assertEquals(RpcErrorType.SERVER_DESERIALIZE, exception.getErrorType());

            RpcInternalContext.getContext().setProviderSide(false);
            exception = serializer.buildDeserializeError("xx");
            Assert.assertEquals(RpcErrorType.CLIENT_DESERIALIZE, exception.getErrorType());

            RpcInternalContext.removeContext();
            exception = serializer.buildDeserializeError("xx", new RuntimeException());
            Assert.assertEquals(RpcErrorType.UNKNOWN, exception.getErrorType());

            RpcInternalContext.getContext().setProviderSide(true);
            exception = serializer.buildDeserializeError("xx", new RuntimeException());
            Assert.assertEquals(RpcErrorType.SERVER_DESERIALIZE, exception.getErrorType());

            RpcInternalContext.getContext().setProviderSide(false);
            exception = serializer.buildDeserializeError("xx", new RuntimeException());
            Assert.assertEquals(RpcErrorType.CLIENT_DESERIALIZE, exception.getErrorType());
        } finally {
            RpcInternalContext.setContext(old);
        }
    }