From 6a60534e8de45aa7d601cccf0da14010dab2acd4 Mon Sep 17 00:00:00 2001
From: fangyincheng <fangyincheng@sina.com>
Date: Sat, 12 Sep 2020 16:36:40 +0800
Subject: [PATCH] Fix: fixed some comments

---
 common/url.go                           |  27 --
 config/application_config.go            |  10 -
 protocol/dubbo/dubbo_codec.go           |   5 +-
 protocol/dubbo/dubbo_invoker.go         |   4 +-
 protocol/dubbo/dubbo_protocol.go        |   6 +-
 protocol/dubbo/impl/codec_test.go       | 113 ------
 protocol/dubbo/impl/proto.go            | 454 ------------------------
 protocol/dubbo/impl/proto/payload.pb.go | 345 ------------------
 protocol/dubbo/impl/proto/payload.proto |  78 ----
 remoting/getty/getty_server.go          |   6 +-
 remoting/getty/listener_test.go         |  12 +-
 test/integrate/dubbo/go-client/go.sum   |  10 +
 test/integrate/dubbo/go-server/go.sum   |  10 +
 13 files changed, 42 insertions(+), 1038 deletions(-)
 delete mode 100644 protocol/dubbo/impl/proto.go
 delete mode 100644 protocol/dubbo/impl/proto/payload.pb.go
 delete mode 100644 protocol/dubbo/impl/proto/payload.proto
 create mode 100644 test/integrate/dubbo/go-client/go.sum
 create mode 100644 test/integrate/dubbo/go-server/go.sum

diff --git a/common/url.go b/common/url.go
index 35e56fef7..8354fda78 100644
--- a/common/url.go
+++ b/common/url.go
@@ -24,7 +24,6 @@ import (
 	"math"
 	"net"
 	"net/url"
-	"sort"
 	"strconv"
 	"strings"
 )
@@ -690,32 +689,6 @@ func mergeNormalParam(mergedUrl *URL, referenceUrl *URL, paramKeys []string) []f
 	return methodConfigMergeFcn
 }
 
-// ParamsUnescapeEncode doesn't encode url reserve character, url.QueryEscape will do this work
-// reference: https://github.com/golang/go.git, src/net/url/url.go, Encode method
-func ParamsUnescapeEncode(params url.Values) string {
-	if params == nil {
-		return ""
-	}
-	var buf strings.Builder
-	keys := make([]string, 0, len(params))
-	for k := range params {
-		keys = append(keys, k)
-	}
-	sort.Strings(keys)
-	for _, k := range keys {
-		vs := params[k]
-		for _, v := range vs {
-			if buf.Len() > 0 {
-				buf.WriteByte('&')
-			}
-			buf.WriteString(k)
-			buf.WriteByte('=')
-			buf.WriteString(v)
-		}
-	}
-	return buf.String()
-}
-
 // URLSlice will be used to sort URL instance
 // Instances will be order by URL.String()
 type URLSlice []URL
diff --git a/config/application_config.go b/config/application_config.go
index 2b9b91c3b..ef99664fa 100644
--- a/config/application_config.go
+++ b/config/application_config.go
@@ -42,16 +42,6 @@ func (*ApplicationConfig) Prefix() string {
 	return constant.DUBBO + ".application."
 }
 
-// nolint
-func (c *ApplicationConfig) Id() string {
-	return ""
-}
-
-// SetId ...
-func (c *ApplicationConfig) SetId(id string) {
-
-}
-
 // UnmarshalYAML unmarshals the ApplicationConfig by @unmarshal function
 func (c *ApplicationConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
 	if err := defaults.Set(c); err != nil {
diff --git a/protocol/dubbo/dubbo_codec.go b/protocol/dubbo/dubbo_codec.go
index 922a0bf98..673588ef2 100644
--- a/protocol/dubbo/dubbo_codec.go
+++ b/protocol/dubbo/dubbo_codec.go
@@ -57,8 +57,9 @@ func (c *DubboCodec) EncodeRequest(request *remoting.Request) (*bytes.Buffer, er
 
 	invoc, ok := request.Data.(*protocol.Invocation)
 	if !ok {
-		logger.Errorf("encode request failed for parameter type :%+v", request)
-		return nil, perrors.Errorf("encode request failed for parameter type :%+v", request)
+		err := perrors.Errorf("encode request failed for parameter type :%+v", request)
+		logger.Errorf(err.Error())
+		return nil, err
 	}
 	invocation := *invoc
 
diff --git a/protocol/dubbo/dubbo_invoker.go b/protocol/dubbo/dubbo_invoker.go
index fa7b0f8cc..bce33508b 100644
--- a/protocol/dubbo/dubbo_invoker.go
+++ b/protocol/dubbo/dubbo_invoker.go
@@ -111,8 +111,8 @@ func (di *DubboInvoker) Invoke(ctx context.Context, invocation protocol.Invocati
 
 	url := di.GetUrl()
 	// default hessian2 serialization, compatible
-	if url.GetParam("serialization", "") == "" {
-		url.SetParam("serialization", constant.HESSIAN2_SERIALIZATION)
+	if url.GetParam(constant.SERIALIZATION_KEY, "") == "" {
+		url.SetParam(constant.SERIALIZATION_KEY, constant.HESSIAN2_SERIALIZATION)
 	}
 	// async
 	async, err := strconv.ParseBool(inv.AttachmentsByKey(constant.ASYNC_KEY, "false"))
diff --git a/protocol/dubbo/dubbo_protocol.go b/protocol/dubbo/dubbo_protocol.go
index a92b9fc71..2826e64d9 100644
--- a/protocol/dubbo/dubbo_protocol.go
+++ b/protocol/dubbo/dubbo_protocol.go
@@ -69,7 +69,7 @@ type DubboProtocol struct {
 	serverLock sync.Mutex
 }
 
-// nolint
+// NewDubboProtocol create a dubbo protocol.
 func NewDubboProtocol() *DubboProtocol {
 	return &DubboProtocol{
 		BaseProtocol: protocol.NewBaseProtocol(),
@@ -77,7 +77,7 @@ func NewDubboProtocol() *DubboProtocol {
 	}
 }
 
-// nolint
+// Export export dubbo service.
 func (dp *DubboProtocol) Export(invoker protocol.Invoker) protocol.Exporter {
 	url := invoker.GetUrl()
 	serviceKey := url.ServiceKey()
@@ -236,7 +236,7 @@ func rebuildCtx(inv *invocation.RPCInvocation) context.Context {
 
 	// actually, if user do not use any opentracing framework, the err will not be nil.
 	spanCtx, err := opentracing.GlobalTracer().Extract(opentracing.TextMap,
-		opentracing.TextMapCarrier(inv.Attachments()))
+		opentracing.TextMapCarrier(filterContext(inv.Attachments())))
 	if err == nil {
 		ctx = context.WithValue(ctx, constant.TRACING_REMOTE_SPAN_CTX, spanCtx)
 	}
diff --git a/protocol/dubbo/impl/codec_test.go b/protocol/dubbo/impl/codec_test.go
index 77cc69a74..03e768dac 100644
--- a/protocol/dubbo/impl/codec_test.go
+++ b/protocol/dubbo/impl/codec_test.go
@@ -80,116 +80,3 @@ func TestDubboPackage_MarshalAndUnmarshal(t *testing.T) {
 	assert.Equal(t, []interface{}{"a"}, reassembleBody["args"])
 	assert.Equal(t, map[string]string{"dubbo": "2.0.2", "interface": "Service", "path": "path", "timeout": "1000", "version": "2.6"}, reassembleBody["attachments"].(map[string]string))
 }
-
-//func TestDubboPackage_Protobuf_Serialization_Request(t *testing.T) {
-//	pkg := NewDubboPackage(nil)
-//	pkg.Body = []interface{}{"a"}
-//	pkg.Header.Type = PackageHeartbeat
-//	pkg.Header.SerialID = constant.S_Proto
-//	pkg.Header.ID = 10086
-//	pkg.SetSerializer(ProtoSerializer{})
-//
-//	// heartbeat
-//	data, err := pkg.Marshal()
-//	assert.NoError(t, err)
-//
-//	pkgres := NewDubboPackage(data)
-//	pkgres.SetSerializer(HessianSerializer{})
-//
-//	pkgres.Body = []interface{}{}
-//	err = pkgres.Unmarshal()
-//	assert.NoError(t, err)
-//	assert.Equal(t, PackageHeartbeat|PackageRequest|PackageRequest_TwoWay, pkgres.Header.Type)
-//	assert.Equal(t, constant.S_Proto, pkgres.Header.SerialID)
-//	assert.Equal(t, int64(10086), pkgres.Header.ID)
-//	assert.Equal(t, 0, len(pkgres.Body.([]interface{})))
-//
-//	// request
-//	pkg.Header.Type = PackageRequest
-//	pkg.Service.Interface = "Service"
-//	pkg.Service.Path = "path"
-//	pkg.Service.Version = "2.6"
-//	pkg.Service.Method = "Method"
-//	pkg.Service.Timeout = time.Second
-//	pkg.SetBody([]interface{}{&pb.StringValue{Value: "hello world"}})
-//	data, err = pkg.Marshal()
-//	assert.NoError(t, err)
-//
-//	pkgres = NewDubboPackage(data)
-//	pkgres.SetSerializer(ProtoSerializer{})
-//	err = pkgres.Unmarshal()
-//	assert.NoError(t, err)
-//	body, ok := pkgres.Body.(map[string]interface{})
-//	assert.Equal(t, ok, true)
-//	req, ok := body["args"].([]interface{})
-//	assert.Equal(t, ok, true)
-//	// protobuf rpc just has exact one parameter
-//	assert.Equal(t, len(req), 1)
-//	argsBytes, ok := req[0].([]byte)
-//	assert.Equal(t, true, ok)
-//	sv := pb.StringValue{}
-//	buf := proto.NewBuffer(argsBytes)
-//	err = buf.Unmarshal(&sv)
-//	assert.NoError(t, err)
-//	assert.Equal(t, "hello world", sv.Value)
-//}
-
-//func TestDubboCodec_Protobuf_Serialization_Response(t *testing.T) {
-//	{
-//		pkg := NewDubboPackage(nil)
-//		pkg.Header.Type = PackageResponse
-//		pkg.Header.SerialID = constant.S_Proto
-//		pkg.Header.ID = 10086
-//		pkg.SetSerializer(ProtoSerializer{})
-//		pkg.SetBody(&pb.StringValue{Value: "hello world"})
-//
-//		// heartbeat
-//		data, err := pkg.Marshal()
-//		assert.NoError(t, err)
-//
-//		pkgres := NewDubboPackage(data)
-//		pkgres.SetSerializer(ProtoSerializer{})
-//
-//		pkgres.SetBody(&pb.StringValue{})
-//		err = pkgres.Unmarshal()
-//
-//		assert.NoError(t, err)
-//		assert.Equal(t, pkgres.Header.Type, PackageResponse)
-//		assert.Equal(t, constant.S_Proto, pkgres.Header.SerialID)
-//		assert.Equal(t, int64(10086), pkgres.Header.ID)
-//
-//		res, ok := pkgres.Body.(*pb.StringValue)
-//		assert.Equal(t, ok, true)
-//		assert.Equal(t, res.Value, "hello world")
-//	}
-//
-//	// with attachments
-//	{
-//		attas := make(map[string]string)
-//		attas["k1"] = "test"
-//		resp := NewResponsePayload(&pb.StringValue{Value: "attachments"}, nil, attas)
-//		p := NewDubboPackage(nil)
-//		p.Header.Type = PackageResponse
-//		p.Header.SerialID = constant.S_Proto
-//		p.SetSerializer(ProtoSerializer{})
-//		p.SetBody(resp)
-//		data, err := p.Marshal()
-//		assert.NoError(t, err)
-//
-//		pkgres := NewDubboPackage(data)
-//		pkgres.Header.Type = PackageResponse
-//		pkgres.Header.SerialID = constant.S_Proto
-//		pkgres.Header.ID = 10086
-//		pkgres.SetSerializer(ProtoSerializer{})
-//
-//		resAttachment := make(map[string]string)
-//		resBody := &pb.StringValue{}
-//		pkgres.SetBody(NewResponsePayload(resBody, nil, resAttachment))
-//
-//		err = pkgres.Unmarshal()
-//		assert.NoError(t, err)
-//		assert.Equal(t, "attachments", resBody.Value)
-//		assert.Equal(t, "test", resAttachment["k1"])
-//	}
-//
-//}
diff --git a/protocol/dubbo/impl/proto.go b/protocol/dubbo/impl/proto.go
deleted file mode 100644
index 2622620b3..000000000
--- a/protocol/dubbo/impl/proto.go
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * 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 impl
-
-import (
-	"bytes"
-	"encoding/binary"
-	"fmt"
-	"github.com/apache/dubbo-go/common/logger"
-	"io"
-	"reflect"
-	"strconv"
-	"strings"
-	"sync"
-	"time"
-)
-
-import (
-	"github.com/golang/protobuf/proto"
-	"github.com/matttproud/golang_protobuf_extensions/pbutil"
-	"github.com/pkg/errors"
-)
-
-import (
-	"github.com/apache/dubbo-go/common"
-	"github.com/apache/dubbo-go/common/constant"
-	pb "github.com/apache/dubbo-go/protocol/dubbo/impl/proto"
-)
-
-type ProtoSerializer struct{}
-
-func (p ProtoSerializer) Marshal(pkg DubboPackage) ([]byte, error) {
-	if pkg.IsHeartBeat() {
-		return []byte{byte('N')}, nil
-	}
-	if pkg.Body == nil {
-		return nil, errors.New("package body should not be nil")
-	}
-	if pkg.IsRequest() {
-		return marshalRequestProto(pkg)
-	}
-	return marshalResponseProto(pkg)
-}
-
-func (p ProtoSerializer) Unmarshal(data []byte, pkg *DubboPackage) error {
-	if pkg.IsRequest() {
-		return unmarshalRequestProto(data, pkg)
-	}
-	return unmarshalResponseProto(data, pkg)
-}
-
-func unmarshalResponseProto(data []byte, pkg *DubboPackage) error {
-	if pkg.Body == nil {
-		pkg.SetBody(NewResponsePayload(nil, nil, nil))
-	}
-	response := EnsureResponsePayload(pkg.Body)
-	buf := bytes.NewBuffer(data)
-
-	var responseType int32
-	if err := readByte(buf, &responseType); err != nil {
-		return err
-	}
-
-	hasAttachments := false
-	hasException := false
-	switch responseType {
-	case RESPONSE_VALUE_WITH_ATTACHMENTS:
-		hasAttachments = true
-	case RESPONSE_WITH_EXCEPTION:
-		hasException = true
-	case RESPONSE_WITH_EXCEPTION_WITH_ATTACHMENTS:
-		hasAttachments = true
-		hasException = true
-	}
-	if hasException {
-		throwable := pb.ThrowableProto{}
-		if err := readObject(buf, &throwable); err != nil {
-			return err
-		}
-		// generate error only with error message
-		response.Exception = errors.New(throwable.OriginalMessage)
-	} else {
-		// read response body
-		protoMsg, ok := response.RspObj.(proto.Message)
-		if !ok {
-			return errors.New("response rspobj not protobuf message")
-		}
-		if err := readObject(buf, protoMsg); err != nil {
-			return err
-		}
-	}
-
-	if hasAttachments {
-		atta := pb.Map{}
-		if err := readObject(buf, &atta); err != nil {
-			return err
-		}
-		if response.Attachments == nil {
-			response.Attachments = atta.Attachments
-		} else {
-			for k, v := range atta.Attachments {
-				response.Attachments[k] = v
-			}
-		}
-
-	}
-	return nil
-}
-
-func unmarshalRequestProto(data []byte, pkg *DubboPackage) error {
-	var dubboVersion string
-	var svcPath string
-	var svcVersion string
-	var svcMethod string
-	buf := bytes.NewBuffer(data)
-	if err := readUTF(buf, &dubboVersion); err != nil {
-		return err
-	}
-	if err := readUTF(buf, &svcPath); err != nil {
-		return err
-	}
-	if err := readUTF(buf, &svcVersion); err != nil {
-		return err
-	}
-	if err := readUTF(buf, &svcMethod); err != nil {
-		return err
-	}
-	// NOTE: protobuf rpc just have exact one parameter, while golang doesn't need this field
-	var argsType string
-	if err := readUTF(buf, &argsType); err != nil {
-		return err
-	}
-	// get raw body bytes for proxy methods to unmarshal
-	var protoMsgLength int
-	if err := readDelimitedLength(buf, &protoMsgLength); err != nil {
-		return err
-	}
-	argBytes := make([]byte, protoMsgLength)
-	if n, err := buf.Read(argBytes); err != nil {
-		if n != protoMsgLength {
-			return errors.New("illegal msg length")
-		}
-		return err
-	}
-	arg := getRegisterMessage(argsType)
-	if !arg.IsZero() {
-		err := proto.Unmarshal(argBytes, arg.Interface().(JavaProto))
-		if err != nil {
-			panic(err)
-		}
-	}
-
-	m := &pb.Map{}
-	if err := readObject(buf, m); err != nil {
-		return err
-	}
-	svc := Service{}
-	svc.Version = svcVersion
-	svc.Method = svcMethod
-	// just as hessian
-	svc.Path = svcPath
-	if svc.Path == "" && len(m.Attachments[constant.PATH_KEY]) > 0 {
-		svc.Path = m.Attachments[constant.PATH_KEY]
-	}
-
-	if _, ok := m.Attachments[constant.INTERFACE_KEY]; ok {
-		svc.Interface = m.Attachments[constant.INTERFACE_KEY]
-	} else {
-		svc.Interface = svc.Path
-	}
-	pkg.SetService(svc)
-	pkg.SetBody(map[string]interface{}{
-		"dubboVersion": dubboVersion,
-		"args":         []interface{}{arg.Interface()},
-		"service":      common.ServiceMap.GetService(DUBBO, svc.Path), // path as a key
-		"attachments":  m.Attachments,
-	})
-
-	return nil
-}
-
-func marshalRequestProto(pkg DubboPackage) ([]byte, error) {
-	request := EnsureRequestPayload(pkg.Body)
-	args, ok := request.Params.([]interface{})
-	buf := bytes.NewBuffer(make([]byte, 0))
-	if !ok {
-		return nil, errors.New("proto buffer args should be marshaled in []byte")
-	}
-	// NOTE: protobuf rpc just has exact one parameter
-	if len(args) != 1 {
-		return nil, errors.New("illegal protobuf service, len(arg) should equal 1")
-	}
-	// dubbo version
-	if err := writeUTF(buf, DUBBO_VERSION); err != nil {
-		return nil, err
-	}
-	// service path
-	if err := writeUTF(buf, pkg.Service.Path); err != nil {
-		return nil, err
-	}
-	// service version
-	if err := writeUTF(buf, pkg.Service.Version); err != nil {
-		return nil, err
-	}
-	// service method
-	if err := writeUTF(buf, pkg.Service.Method); err != nil {
-		return nil, err
-	}
-	// parameter types desc
-	v := reflect.ValueOf(args[0])
-	mv := v.MethodByName("JavaClassName")
-	if mv.IsValid() {
-		javaCls := mv.Call([]reflect.Value{})
-		if len(javaCls) != 1 {
-			return nil, errors.New("JavaStringName method should return exact 1 result")
-		}
-		javaClsStr, ok := javaCls[0].Interface().(string)
-		if !ok {
-			return nil, errors.New("JavaClassName method should return string")
-		}
-		if err := writeUTF(buf, getJavaArgType(javaClsStr)); err != nil {
-			return nil, err
-		}
-	} else {
-		// defensive code
-		if err := writeUTF(buf, ""); err != nil {
-			return nil, err
-		}
-	}
-	// consumer args
-	protoMsg := args[0].(proto.Message)
-	if err := writeObject(buf, protoMsg); err != nil {
-		return nil, err
-	}
-	// attachments
-	atta := make(map[string]string)
-	atta[PATH_KEY] = pkg.Service.Path
-	atta[VERSION_KEY] = pkg.Service.Version
-	if len(pkg.Service.Group) > 0 {
-		atta[GROUP_KEY] = pkg.Service.Group
-	}
-	if len(pkg.Service.Interface) > 0 {
-		atta[INTERFACE_KEY] = pkg.Service.Interface
-	}
-	if pkg.Service.Timeout != 0 {
-		atta[TIMEOUT_KEY] = strconv.Itoa(int(pkg.Service.Timeout / time.Millisecond))
-	}
-	m := pb.Map{Attachments: atta}
-	if err := writeObject(buf, &m); err != nil {
-		return nil, err
-	}
-	return buf.Bytes(), nil
-}
-
-func marshalResponseProto(pkg DubboPackage) ([]byte, error) {
-	response := EnsureResponsePayload(pkg.Body)
-	buf := bytes.NewBuffer(make([]byte, 0))
-	responseType := RESPONSE_VALUE
-	hasAttachments := false
-	if response.Attachments != nil {
-		responseType = RESPONSE_VALUE_WITH_ATTACHMENTS
-		hasAttachments = true
-	} else {
-		responseType = RESPONSE_VALUE
-	}
-	if response.Exception != nil {
-		if hasAttachments {
-			responseType = RESPONSE_WITH_EXCEPTION_WITH_ATTACHMENTS
-		} else {
-			responseType = RESPONSE_WITH_EXCEPTION
-		}
-	}
-	// write response type
-	if err := writeByte(buf, responseType); err != nil {
-		return nil, err
-	}
-	if response.Exception != nil {
-		// deal with exception
-		throwable := pb.ThrowableProto{OriginalMessage: response.Exception.Error()}
-		if err := writeObject(buf, &throwable); err != nil {
-			return nil, err
-		}
-	} else {
-		res, ok := response.RspObj.(proto.Message)
-		if !ok {
-			return nil, errors.New("proto buffer params should be marshaled in proto.Message")
-		}
-		// response body
-		if err := writeObject(buf, res); err != nil {
-			return nil, err
-		}
-	}
-
-	if hasAttachments {
-		attachments := pb.Map{Attachments: response.Attachments}
-		if err := writeObject(buf, &attachments); err != nil {
-			return nil, err
-		}
-	}
-	return buf.Bytes(), nil
-}
-
-func init() {
-	SetSerializer("protobuf", ProtoSerializer{})
-}
-
-func getJavaArgType(javaClsName string) string {
-	return fmt.Sprintf("L%s;", strings.ReplaceAll(javaClsName, ".", "/"))
-}
-
-func writeUTF(writer io.Writer, value string) error {
-	_, err := pbutil.WriteDelimited(writer, &pb.StringValue{Value: value})
-	return err
-}
-
-func writeObject(writer io.Writer, value proto.Message) error {
-	_, err := pbutil.WriteDelimited(writer, value)
-	return err
-}
-
-func writeByte(writer io.Writer, v int32) error {
-	i32v := &pb.Int32Value{Value: v}
-	_, err := pbutil.WriteDelimited(writer, i32v)
-	return err
-}
-
-func readUTF(reader io.Reader, value *string) error {
-	sv := &pb.StringValue{}
-	_, err := pbutil.ReadDelimited(reader, sv)
-	if err != nil {
-		return err
-	}
-	*value = sv.Value
-	return nil
-}
-
-func readObject(reader io.Reader, value proto.Message) error {
-	_, err := pbutil.ReadDelimited(reader, value)
-	if err != nil {
-		return err
-	}
-	return nil
-}
-
-// just as java protobuf serialize
-func readByte(reader io.Reader, value *int32) error {
-	i32v := &pb.Int32Value{}
-	_, err := pbutil.ReadDelimited(reader, i32v)
-	if err != nil {
-		return err
-	}
-	*value = i32v.Value
-	return nil
-}
-
-//
-func readDelimitedLength(reader io.Reader, length *int) error {
-	var headerBuf [binary.MaxVarintLen32]byte
-	var bytesRead, varIntBytes int
-	var messageLength uint64
-	for varIntBytes == 0 { // i.e. no varint has been decoded yet.
-		if bytesRead >= len(headerBuf) {
-			return errors.New("invalid varint32 encountered")
-		}
-		// We have to read byte by byte here to avoid reading more bytes
-		// than required. Each read byte is appended to what we have
-		// read before.
-		newBytesRead, err := reader.Read(headerBuf[bytesRead : bytesRead+1])
-		if newBytesRead == 0 {
-			if err != nil {
-				return err
-			}
-			// A Reader should not return (0, nil), but if it does,
-			// it should be treated as no-op (according to the
-			// Reader contract). So let's go on...
-			continue
-		}
-		bytesRead += newBytesRead
-		// Now present everything read so far to the varint decoder and
-		// see if a varint can be decoded already.
-		messageLength, varIntBytes = proto.DecodeVarint(headerBuf[:bytesRead])
-	}
-	*length = int(messageLength)
-	return nil
-}
-
-type JavaProto interface {
-	JavaClassName() string
-	proto.Message
-}
-
-type Register struct {
-	sync.RWMutex
-	registry map[string]reflect.Type
-}
-
-var (
-	register = Register{
-		registry: make(map[string]reflect.Type),
-	}
-)
-
-func RegisterMessage(msg JavaProto) {
-	register.Lock()
-	defer register.Unlock()
-
-	name := msg.JavaClassName()
-	name = getJavaArgType(name)
-
-	if e, ok := register.registry[name]; ok {
-		panic(fmt.Sprintf("msg: %v has been registered. existed: %v", msg.JavaClassName(), e))
-	}
-
-	register.registry[name] = typeOfMessage(msg)
-}
-
-func getRegisterMessage(sig string) reflect.Value {
-	register.Lock()
-	defer register.Unlock()
-
-	t, ok := register.registry[sig]
-	if !ok {
-		logger.Error(fmt.Sprintf("registry dose not have for svc: %v", sig))
-		return NilValue
-	}
-	return reflect.New(t)
-}
-
-func typeOfMessage(o proto.Message) reflect.Type {
-	v := reflect.ValueOf(o)
-	switch v.Kind() {
-	case reflect.Struct:
-		return v.Type()
-	case reflect.Ptr:
-		return v.Elem().Type()
-	}
-
-	return reflect.TypeOf(o)
-}
diff --git a/protocol/dubbo/impl/proto/payload.pb.go b/protocol/dubbo/impl/proto/payload.pb.go
deleted file mode 100644
index 337027e86..000000000
--- a/protocol/dubbo/impl/proto/payload.pb.go
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * 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.
- */
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: proto/payload.proto
-
-package payload
-
-import (
-	fmt "fmt"
-	math "math"
-
-	proto "github.com/golang/protobuf/proto"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
-// equivalent java StringValue
-type StringValue struct {
-	Value                string   `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *StringValue) Reset()         { *m = StringValue{} }
-func (m *StringValue) String() string { return proto.CompactTextString(m) }
-func (*StringValue) ProtoMessage()    {}
-func (*StringValue) Descriptor() ([]byte, []int) {
-	return fileDescriptor_434bbf44284586dc, []int{0}
-}
-
-func (m *StringValue) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_StringValue.Unmarshal(m, b)
-}
-func (m *StringValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_StringValue.Marshal(b, m, deterministic)
-}
-func (m *StringValue) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_StringValue.Merge(m, src)
-}
-func (m *StringValue) XXX_Size() int {
-	return xxx_messageInfo_StringValue.Size(m)
-}
-func (m *StringValue) XXX_DiscardUnknown() {
-	xxx_messageInfo_StringValue.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_StringValue proto.InternalMessageInfo
-
-func (m *StringValue) GetValue() string {
-	if m != nil {
-		return m.Value
-	}
-	return ""
-}
-
-// equivalent java Int32Value
-type Int32Value struct {
-	Value                int32    `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *Int32Value) Reset()         { *m = Int32Value{} }
-func (m *Int32Value) String() string { return proto.CompactTextString(m) }
-func (*Int32Value) ProtoMessage()    {}
-func (*Int32Value) Descriptor() ([]byte, []int) {
-	return fileDescriptor_434bbf44284586dc, []int{1}
-}
-
-func (m *Int32Value) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_Int32Value.Unmarshal(m, b)
-}
-func (m *Int32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_Int32Value.Marshal(b, m, deterministic)
-}
-func (m *Int32Value) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_Int32Value.Merge(m, src)
-}
-func (m *Int32Value) XXX_Size() int {
-	return xxx_messageInfo_Int32Value.Size(m)
-}
-func (m *Int32Value) XXX_DiscardUnknown() {
-	xxx_messageInfo_Int32Value.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Int32Value proto.InternalMessageInfo
-
-func (m *Int32Value) GetValue() int32 {
-	if m != nil {
-		return m.Value
-	}
-	return 0
-}
-
-// equivalent java MapValue
-type Map struct {
-	Attachments          map[string]string `protobuf:"bytes,1,rep,name=attachments,proto3" json:"attachments,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
-	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
-	XXX_unrecognized     []byte            `json:"-"`
-	XXX_sizecache        int32             `json:"-"`
-}
-
-func (m *Map) Reset()         { *m = Map{} }
-func (m *Map) String() string { return proto.CompactTextString(m) }
-func (*Map) ProtoMessage()    {}
-func (*Map) Descriptor() ([]byte, []int) {
-	return fileDescriptor_434bbf44284586dc, []int{2}
-}
-
-func (m *Map) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_Map.Unmarshal(m, b)
-}
-func (m *Map) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_Map.Marshal(b, m, deterministic)
-}
-func (m *Map) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_Map.Merge(m, src)
-}
-func (m *Map) XXX_Size() int {
-	return xxx_messageInfo_Map.Size(m)
-}
-func (m *Map) XXX_DiscardUnknown() {
-	xxx_messageInfo_Map.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Map proto.InternalMessageInfo
-
-func (m *Map) GetAttachments() map[string]string {
-	if m != nil {
-		return m.Attachments
-	}
-	return nil
-}
-
-// copied from dubbo GenericProtobufObjectOutput.java
-// Messages used for transporting debug information between server and client.
-// An element in a stack trace, based on the Java type of the same name.
-//
-// See: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/StackTraceElement.html
-type StackTraceElementProto struct {
-	// The fully qualified name of the class containing the execution point
-	// represented by the stack trace element.
-	ClassName string `protobuf:"bytes,1,opt,name=class_name,json=className,proto3" json:"class_name,omitempty"`
-	// The name of the method containing the execution point represented by the
-	// stack trace element
-	MethodName string `protobuf:"bytes,2,opt,name=method_name,json=methodName,proto3" json:"method_name,omitempty"`
-	// The name of the file containing the execution point represented by the
-	// stack trace element, or null if this information is unavailable.
-	FileName string `protobuf:"bytes,3,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"`
-	// The line number of the source line containing the execution point represented
-	// by this stack trace element, or a negative number if this information is
-	// unavailable.
-	LineNumber           int32    `protobuf:"varint,4,opt,name=line_number,json=lineNumber,proto3" json:"line_number,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *StackTraceElementProto) Reset()         { *m = StackTraceElementProto{} }
-func (m *StackTraceElementProto) String() string { return proto.CompactTextString(m) }
-func (*StackTraceElementProto) ProtoMessage()    {}
-func (*StackTraceElementProto) Descriptor() ([]byte, []int) {
-	return fileDescriptor_434bbf44284586dc, []int{3}
-}
-
-func (m *StackTraceElementProto) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_StackTraceElementProto.Unmarshal(m, b)
-}
-func (m *StackTraceElementProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_StackTraceElementProto.Marshal(b, m, deterministic)
-}
-func (m *StackTraceElementProto) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_StackTraceElementProto.Merge(m, src)
-}
-func (m *StackTraceElementProto) XXX_Size() int {
-	return xxx_messageInfo_StackTraceElementProto.Size(m)
-}
-func (m *StackTraceElementProto) XXX_DiscardUnknown() {
-	xxx_messageInfo_StackTraceElementProto.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_StackTraceElementProto proto.InternalMessageInfo
-
-func (m *StackTraceElementProto) GetClassName() string {
-	if m != nil {
-		return m.ClassName
-	}
-	return ""
-}
-
-func (m *StackTraceElementProto) GetMethodName() string {
-	if m != nil {
-		return m.MethodName
-	}
-	return ""
-}
-
-func (m *StackTraceElementProto) GetFileName() string {
-	if m != nil {
-		return m.FileName
-	}
-	return ""
-}
-
-func (m *StackTraceElementProto) GetLineNumber() int32 {
-	if m != nil {
-		return m.LineNumber
-	}
-	return 0
-}
-
-// An exception that was thrown by some code, based on the Java type of the same name.
-//
-// See: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Throwable.html
-type ThrowableProto struct {
-	// The name of the class of the exception that was actually thrown. Downstream readers
-	// of this message may or may not have the actual class available to initialize, so
-	// this is just used to prefix the message of a generic exception type.
-	OriginalClassName string `protobuf:"bytes,1,opt,name=original_class_name,json=originalClassName,proto3" json:"original_class_name,omitempty"`
-	// The message of this throwable. Not filled if there is no message.
-	OriginalMessage string `protobuf:"bytes,2,opt,name=original_message,json=originalMessage,proto3" json:"original_message,omitempty"`
-	// The stack trace of this Throwable.
-	StackTrace []*StackTraceElementProto `protobuf:"bytes,3,rep,name=stack_trace,json=stackTrace,proto3" json:"stack_trace,omitempty"`
-	// The cause of this Throwable. Not filled if there is no cause.
-	Cause                *ThrowableProto `protobuf:"bytes,4,opt,name=cause,proto3" json:"cause,omitempty"`
-	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
-	XXX_unrecognized     []byte          `json:"-"`
-	XXX_sizecache        int32           `json:"-"`
-}
-
-func (m *ThrowableProto) Reset()         { *m = ThrowableProto{} }
-func (m *ThrowableProto) String() string { return proto.CompactTextString(m) }
-func (*ThrowableProto) ProtoMessage()    {}
-func (*ThrowableProto) Descriptor() ([]byte, []int) {
-	return fileDescriptor_434bbf44284586dc, []int{4}
-}
-
-func (m *ThrowableProto) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_ThrowableProto.Unmarshal(m, b)
-}
-func (m *ThrowableProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_ThrowableProto.Marshal(b, m, deterministic)
-}
-func (m *ThrowableProto) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_ThrowableProto.Merge(m, src)
-}
-func (m *ThrowableProto) XXX_Size() int {
-	return xxx_messageInfo_ThrowableProto.Size(m)
-}
-func (m *ThrowableProto) XXX_DiscardUnknown() {
-	xxx_messageInfo_ThrowableProto.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_ThrowableProto proto.InternalMessageInfo
-
-func (m *ThrowableProto) GetOriginalClassName() string {
-	if m != nil {
-		return m.OriginalClassName
-	}
-	return ""
-}
-
-func (m *ThrowableProto) GetOriginalMessage() string {
-	if m != nil {
-		return m.OriginalMessage
-	}
-	return ""
-}
-
-func (m *ThrowableProto) GetStackTrace() []*StackTraceElementProto {
-	if m != nil {
-		return m.StackTrace
-	}
-	return nil
-}
-
-func (m *ThrowableProto) GetCause() *ThrowableProto {
-	if m != nil {
-		return m.Cause
-	}
-	return nil
-}
-
-func init() {
-	proto.RegisterType((*StringValue)(nil), "StringValue")
-	proto.RegisterType((*Int32Value)(nil), "Int32Value")
-	proto.RegisterType((*Map)(nil), "Map")
-	proto.RegisterMapType((map[string]string)(nil), "Map.AttachmentsEntry")
-	proto.RegisterType((*StackTraceElementProto)(nil), "StackTraceElementProto")
-	proto.RegisterType((*ThrowableProto)(nil), "ThrowableProto")
-}
-
-func init() { proto.RegisterFile("proto/payload.proto", fileDescriptor_434bbf44284586dc) }
-
-var fileDescriptor_434bbf44284586dc = []byte{
-	// 353 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x4f, 0x4f, 0xea, 0x40,
-	0x14, 0xc5, 0x53, 0xfa, 0x78, 0x79, 0xdc, 0x26, 0x0f, 0x1c, 0xfc, 0xd3, 0x68, 0x8c, 0xa4, 0xc6,
-	0x04, 0x37, 0x35, 0x81, 0x85, 0xc4, 0x85, 0x89, 0x31, 0x2c, 0x5c, 0x40, 0x4c, 0x21, 0x6e, 0x9b,
-	0x4b, 0x19, 0xa1, 0x61, 0x3a, 0x6d, 0x66, 0x06, 0x0d, 0x1b, 0x3f, 0x86, 0x9f, 0xca, 0x0f, 0x65,
-	0x66, 0xc6, 0x02, 0x2a, 0xbb, 0x99, 0xdf, 0x39, 0xbd, 0x3d, 0xf7, 0x64, 0xa0, 0x59, 0x88, 0x5c,
-	0xe5, 0x57, 0x05, 0xae, 0x58, 0x8e, 0xd3, 0xd0, 0xdc, 0x82, 0x73, 0xf0, 0x46, 0x4a, 0xa4, 0x7c,
-	0xf6, 0x84, 0x6c, 0x49, 0xc9, 0x3e, 0x54, 0x5f, 0xf4, 0xc1, 0x77, 0x5a, 0x4e, 0xbb, 0x16, 0xd9,
-	0x4b, 0x10, 0x00, 0x3c, 0x70, 0xd5, 0xed, 0xec, 0xf0, 0x54, 0x4b, 0xcf, 0x1b, 0xb8, 0x03, 0x2c,
-	0xc8, 0x35, 0x78, 0xa8, 0x14, 0x26, 0xf3, 0x8c, 0x72, 0x25, 0x7d, 0xa7, 0xe5, 0xb6, 0xbd, 0xce,
-	0x41, 0x38, 0xc0, 0x22, 0xbc, 0xdb, 0xf0, 0x3e, 0x57, 0x62, 0x15, 0x6d, 0x3b, 0x8f, 0x6f, 0xa1,
-	0xf1, 0xd3, 0x40, 0x1a, 0xe0, 0x2e, 0xe8, 0xea, 0x2b, 0x8b, 0x3e, 0x6e, 0xfe, 0x5d, 0xd9, 0xca,
-	0x77, 0x53, 0xe9, 0x39, 0xc1, 0xbb, 0x03, 0x87, 0x23, 0x85, 0xc9, 0x62, 0x2c, 0x30, 0xa1, 0x7d,
-	0x46, 0xf5, 0x9c, 0x47, 0xbd, 0x23, 0x39, 0x05, 0x48, 0x18, 0x4a, 0x19, 0x73, 0xcc, 0xca, 0xcd,
-	0x6a, 0x86, 0x0c, 0x31, 0xa3, 0xe4, 0x0c, 0xbc, 0x8c, 0xaa, 0x79, 0x3e, 0xb5, 0xba, 0x9d, 0x0c,
-	0x16, 0x19, 0xc3, 0x09, 0xd4, 0x9e, 0x53, 0x46, 0xad, 0xec, 0x1a, 0xf9, 0x9f, 0x06, 0xe5, 0xd7,
-	0x2c, 0xe5, 0x34, 0xe6, 0xcb, 0x6c, 0x42, 0x85, 0xff, 0xc7, 0x74, 0x02, 0x1a, 0x0d, 0x0d, 0x09,
-	0x3e, 0x1c, 0xf8, 0x3f, 0x9e, 0x8b, 0xfc, 0x15, 0x27, 0x8c, 0xda, 0x40, 0x21, 0x34, 0x73, 0x91,
-	0xce, 0x52, 0x8e, 0x2c, 0xfe, 0x95, 0x6c, 0xaf, 0x94, 0xee, 0xd7, 0x09, 0x2f, 0xa1, 0xb1, 0xf6,
-	0x67, 0x54, 0x4a, 0x9c, 0x95, 0x31, 0xeb, 0x25, 0x1f, 0x58, 0x4c, 0x7a, 0xe0, 0x49, 0xdd, 0x42,
-	0xac, 0x74, 0x0d, 0xbe, 0x6b, 0xfa, 0x3f, 0x0a, 0x77, 0x37, 0x13, 0x81, 0x5c, 0x73, 0x72, 0x01,
-	0xd5, 0x04, 0x97, 0x92, 0x9a, 0x15, 0xbc, 0x4e, 0x3d, 0xfc, 0x1e, 0x3a, 0xb2, 0xea, 0xe4, 0xaf,
-	0x79, 0x37, 0xdd, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x04, 0x4d, 0x68, 0x3a, 0x4e, 0x02, 0x00,
-	0x00,
-}
diff --git a/protocol/dubbo/impl/proto/payload.proto b/protocol/dubbo/impl/proto/payload.proto
deleted file mode 100644
index 19f644ee9..000000000
--- a/protocol/dubbo/impl/proto/payload.proto
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.
- */
-
-syntax = "proto3";
-
-// equivalent java StringValue
-message StringValue {
-    string value = 1;
-}
-
-// equivalent java Int32Value
-message Int32Value {
-    int32 value = 1;
-}
-
-// equivalent java MapValue
-message Map {
-    map<string, string> attachments = 1;
-}
-
-// copied from dubbo GenericProtobufObjectOutput.java
-// Messages used for transporting debug information between server and client.
-// An element in a stack trace, based on the Java type of the same name.
-//
-// See: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/StackTraceElement.html
-message StackTraceElementProto {
-    // The fully qualified name of the class containing the execution point
-    // represented by the stack trace element.
-    string class_name = 1;
-
-    // The name of the method containing the execution point represented by the
-    // stack trace element
-    string method_name = 2;
-
-    // The name of the file containing the execution point represented by the
-    // stack trace element, or null if this information is unavailable.
-    string file_name = 3;
-
-    // The line number of the source line containing the execution point represented
-    // by this stack trace element, or a negative number if this information is
-    // unavailable.
-    int32 line_number = 4;
-}
-
-// An exception that was thrown by some code, based on the Java type of the same name.
-//
-// See: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Throwable.html
-message ThrowableProto {
-    // The name of the class of the exception that was actually thrown. Downstream readers
-    // of this message may or may not have the actual class available to initialize, so
-    // this is just used to prefix the message of a generic exception type.
-    string original_class_name = 1;
-
-    // The message of this throwable. Not filled if there is no message.
-    string original_message = 2;
-
-    // The stack trace of this Throwable.
-    repeated StackTraceElementProto stack_trace = 3;
-
-    // The cause of this Throwable. Not filled if there is no cause.
-    ThrowableProto cause = 4;
-}
-
-
diff --git a/remoting/getty/getty_server.go b/remoting/getty/getty_server.go
index 731ad8795..98ca690cb 100644
--- a/remoting/getty/getty_server.go
+++ b/remoting/getty/getty_server.go
@@ -79,7 +79,7 @@ func initServer(protocol string) {
 	SetServerGrpool()
 }
 
-// SetServerConfig ...
+// SetServerConfig set dubbo server config.
 func SetServerConfig(s ServerConfig) {
 	srvConf = &s
 	err := srvConf.CheckValidity()
@@ -90,7 +90,7 @@ func SetServerConfig(s ServerConfig) {
 	SetServerGrpool()
 }
 
-// GetServerConfig ...
+// GetServerConfig get getty server config.
 func GetServerConfig() ServerConfig {
 	return *srvConf
 }
@@ -184,7 +184,7 @@ func (s *Server) newSession(session getty.Session) error {
 	return nil
 }
 
-// Start ...
+// Start dubbo server.
 func (s *Server) Start() {
 	var (
 		addr      string
diff --git a/remoting/getty/listener_test.go b/remoting/getty/listener_test.go
index 3d1787a33..7a54323d1 100644
--- a/remoting/getty/listener_test.go
+++ b/remoting/getty/listener_test.go
@@ -65,9 +65,19 @@ func rebuildCtx(inv *invocation.RPCInvocation) context.Context {
 
 	// actually, if user do not use any opentracing framework, the err will not be nil.
 	spanCtx, err := opentracing.GlobalTracer().Extract(opentracing.TextMap,
-		opentracing.TextMapCarrier(inv.Attachments()))
+		opentracing.TextMapCarrier(filterContext(inv.Attachments())))
 	if err == nil {
 		ctx = context.WithValue(ctx, constant.TRACING_REMOTE_SPAN_CTX, spanCtx)
 	}
 	return ctx
 }
+
+func filterContext(attachments map[string]interface{}) map[string]string {
+	var traceAttchment = make(map[string]string)
+	for k, v := range attachments {
+		if r, ok := v.(string); ok {
+			traceAttchment[k] = r
+		}
+	}
+	return traceAttchment
+}
diff --git a/test/integrate/dubbo/go-client/go.sum b/test/integrate/dubbo/go-client/go.sum
new file mode 100644
index 000000000..7bb51161b
--- /dev/null
+++ b/test/integrate/dubbo/go-client/go.sum
@@ -0,0 +1,10 @@
+github.com/apache/dubbo-go-hessian2 v1.6.0-rc1.0.20200906044240-6c1fb5c3bd44/go.mod h1:7rEw9guWABQa6Aqb8HeZcsYPHsOS7XT1qtJvkmI6c5w=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dubbogo/gost v1.9.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/test/integrate/dubbo/go-server/go.sum b/test/integrate/dubbo/go-server/go.sum
new file mode 100644
index 000000000..7bb51161b
--- /dev/null
+++ b/test/integrate/dubbo/go-server/go.sum
@@ -0,0 +1,10 @@
+github.com/apache/dubbo-go-hessian2 v1.6.0-rc1.0.20200906044240-6c1fb5c3bd44/go.mod h1:7rEw9guWABQa6Aqb8HeZcsYPHsOS7XT1qtJvkmI6c5w=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dubbogo/gost v1.9.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-- 
GitLab