* Dubbo version: 3.1.2
* Java version: 1.8.0_322


1. DUBBO 协议原使用序列化方式为 hessin2 , Triple 协议 RPCType：UNARY 也是用  hessin2 .
2. 拿到 响应的 Response 时候， 发现 序列化成了 父类的实例，查阅代码发现。 

原来使用 DUBBO协议的时候使用的代码如下：
DecodeableRpcResult

`private void handleValue(ObjectInput in) throws IOException {
        try {
            Type[] returnTypes;
            if (invocation instanceof RpcInvocation) {
                returnTypes = ((RpcInvocation) invocation).getReturnTypes();
            } else {
                returnTypes = RpcUtils.getReturnTypes(invocation);
            }
            Object value;
            if (ArrayUtils.isEmpty(returnTypes)) {
                // This almost never happens?
                value = in.readObject();
            } else if (returnTypes.length == 1) {
                value = in.readObject((Class<?>) returnTypes[0]);
            } else {
                value = in.readObject((Class<?>) returnTypes[0], returnTypes[1]);
            }
            setValue(value);
        } catch (ClassNotFoundException e) {
            rethrow(e);
        }
    }`

通过 响应类的类型做序列化。 ` in.readObject((Class<?>) returnTypes[0], returnTypes[1]);`

但是 在 做 Triple 协议 反序列化时：

默认使用 DefaultMultipleSerialization  做序列化

` @Override
    public Object deserialize(URL url, String serializeType, String clz, InputStream os) throws IOException, ClassNotFoundException {
        serializeType = convertHessian(serializeType);
        final Serialization serialization = url.getOrDefaultFrameworkModel().getExtensionLoader(Serialization.class).getExtension(serializeType);
        final ObjectInput in = serialization.deserialize(null, os);
        return in.readObject();
    }`

没有使用 响应类的类型 `return in.readObject();`

因此  返回的是 父类， 因此出现异常。 


目前 只能通过 扩展 MultipleSerialization  解决。














/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.dubbo.common.serialize;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.ExtensionScope;
import org.apache.dubbo.common.extension.SPI;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@SPI(scope = ExtensionScope.FRAMEWORK)
public interface MultipleSerialization {
    void serialize(URL url, String serializeType, String clz, Object obj, OutputStream os) throws IOException;
    Object deserialize(URL url, String serializeType, String clz, InputStream os) throws IOException, ClassNotFoundException;
}