class ProtobufSerialization implements Serialization {
    @Override
    public byte[] serialize(Object obj) throws IOException {<FILL_FUNCTION_BODY>}

    @SuppressWarnings("unchecked")
    @Override
    public <T> T deserialize(byte[] bytes, Class<T> clazz) throws IOException {
        CodedInputStream in = CodedInputStream.newInstance(bytes);
        // 兼容motan1 协议，对throwable类型消息 反序列化String类型的error message，转化为MotanServiceException抛出
        if (Throwable.class.isAssignableFrom(clazz)) {
            String errorMessage = (String) deserialize(in, String.class);
            throw new MotanServiceException(clazz.getName() + ":" + errorMessage);
        } else {
            return (T) deserialize(in, clazz);
        }
    }

    @Override
    public byte[] serializeMulti(Object[] data) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
        CodedOutputStream output = CodedOutputStream.newInstance(baos);
        for (Object obj : data) {
            serialize(output, obj);
        }
        output.flush();
        return baos.toByteArray();
    }

    @Override
    public Object[] deserializeMulti(byte[] data, Class<?>[] classes) throws IOException {
        CodedInputStream in = CodedInputStream.newInstance(data);
        Object[] objects = new Object[classes.length];
        for (int i = 0; i < classes.length; i++) {
            objects[i] = deserialize(in, classes[i]);
        }
        return objects;
    }

    protected void serialize(CodedOutputStream output, Object obj) throws IOException {
        if (obj == null) {
            output.writeBoolNoTag(true);
        } else {
            output.writeBoolNoTag(false);
            Class<?> clazz = obj.getClass();
            if (clazz == Integer.class) {
                output.writeSInt32NoTag((Integer) obj);
            } else if (clazz == Long.class) {
                output.writeSInt64NoTag((Long) obj);
            } else if (clazz == Boolean.class) {
                output.writeBoolNoTag((Boolean) obj);
            } else if (clazz == Byte.class) {
                output.writeRawByte((Byte) obj);
            } else if (clazz == Character.class) {
                output.writeSInt32NoTag((Character) obj);
            } else if (clazz == Short.class) {
                output.writeSInt32NoTag((Short) obj);
            } else if (clazz == Double.class) {
                output.writeDoubleNoTag((Double) obj);
            } else if (clazz == Float.class) {
                output.writeFloatNoTag((Float) obj);
            } else if (clazz == String.class) {
                output.writeStringNoTag(obj.toString());
            } else if (MessageLite.class.isAssignableFrom(clazz)) {
                output.writeMessageNoTag((MessageLite) obj);
            } else {
                throw new IllegalArgumentException("can't serialize " + clazz);
            }
        }
    }

    protected Object deserialize(CodedInputStream in, Class<?> clazz) throws IOException {
        if (in.readBool()) {
            return null;
        } else {
            Object value;
            if (clazz == int.class || clazz == Integer.class) {
                value = in.readSInt32();
            } else if (clazz == long.class || clazz == Long.class) {
                value = in.readSInt64();
            } else if (clazz == boolean.class || clazz == Boolean.class) {
                value = in.readBool();
            } else if (clazz == byte.class || clazz == Byte.class) {
                value = in.readRawByte();
            } else if (clazz == char.class || clazz == Character.class) {
                value = (char) in.readSInt32();
            } else if (clazz == short.class || clazz == Short.class) {
                value = (short) in.readSInt32();
            } else if (clazz == double.class || clazz == Double.class) {
                value = in.readDouble();
            } else if (clazz == float.class || clazz == Float.class) {
                value = in.readFloat();
            } else if (clazz == String.class) {
                value = in.readString();
            } else if (MessageLite.class.isAssignableFrom(clazz)) {

                try {
                    Method method = clazz.getDeclaredMethod("newBuilder");
                    MessageLite.Builder builder = (MessageLite.Builder) method.invoke(null);
                    in.readMessage(builder, null);
                    value = builder.build();
                } catch (Exception e) {
                    throw new MotanFrameworkException(e);
                }
            } else {
                throw new IllegalArgumentException("can't serialize " + clazz);
            }
            return value;
        }
    }

    @Override
    public int getSerializationNumber() {
        return 5;
    }
}

        ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
        CodedOutputStream output = CodedOutputStream.newInstance(baos);
        // 兼容motan1 协议，对throwable仅将异常信息进行序列化
        if (obj != null && Throwable.class.isAssignableFrom(obj.getClass())) {
            serialize(output, ((Throwable)obj).getMessage());
        } else {
            serialize(output, obj);
        }
        output.flush();
        return baos.toByteArray();
    
<no_super_class>