Fix dubbo select local server error (#33)

diff --git a/protocol/dubbo/proxy/dubbo_proxy_ouput.go b/protocol/dubbo/proxy/dubbo_proxy_ouput.go
index cf076c6..276a651 100755
--- a/protocol/dubbo/proxy/dubbo_proxy_ouput.go
+++ b/protocol/dubbo/proxy/dubbo_proxy_ouput.go
@@ -36,6 +36,7 @@
 	"github.com/go-chassis/go-chassis/pkg/util/httputil"
 	"github.com/go-chassis/go-chassis/pkg/util/tags"
 	"github.com/go-chassis/go-chassis/third_party/forked/afex/hystrix-go/hystrix"
+	"github.com/go-mesh/mesher/cmd"
 	mesherCommon "github.com/go-mesh/mesher/common"
 	mesherRuntime "github.com/go-mesh/mesher/pkg/runtime"
 	"github.com/go-mesh/mesher/protocol"
@@ -164,6 +165,24 @@
 
 }
 
+//SetLocalServiceAddress assign invocation endpoint a local service address
+// it uses config in cmd or env fi
+// if it is empty, then try to use original port from client as local port
+func SetLocalServiceAddress(inv *invocation.Invocation) error {
+	inv.Endpoint = cmd.Configs.PortsMap[inv.Protocol]
+	if inv.Endpoint == "" {
+		if inv.Port != "" {
+			inv.Endpoint = "127.0.0.1:" + inv.Port
+			cmd.Configs.PortsMap[inv.Protocol] = inv.Endpoint
+			return nil
+		} else {
+			return fmt.Errorf("[%s] is not supported, [%s] didn't set env [%s] or cmd parameter --service-ports before mesher start",
+				inv.Protocol, inv.MicroServiceName, mesherCommon.EnvServicePorts)
+		}
+	}
+	return nil
+}
+
 //Handle is a function
 func Handle(ctx *dubbo.InvokeContext) error {
 	interfaceName := ctx.Req.GetAttachment(dubbo.PathKey, "")
@@ -187,6 +206,7 @@
 	}
 	inv.URLPathFormat = ""
 	inv.Reply = &dubboclient.WrapResponse{nil} //&rest.Response{Resp: &ctx.Response}
+	SetLocalServiceAddress(inv)                //select local service
 	var err error
 	var c *handler.Chain
 
@@ -276,6 +296,7 @@
 	inv.SchemaID = ""
 	inv.OperationID = ""
 	inv.Ctx = context.Background()
+	SetLocalServiceAddress(inv) //select local service
 	source := stringutil.SplitFirstSep(ctx.RemoteAddr, ":")
 	return restReq, inv, source
 }