This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch 3.0-k8s
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0-k8s by this push:
     new d07a0a5  Fix Unit test cases in 3.0 branch (#6598)
d07a0a5 is described below

commit d07a0a55af59083b46f4f1c674735e9a2c957e02
Author: Albumen Kevin <[email protected]>
AuthorDate: Mon Aug 17 13:06:31 2020 +0800

    Fix Unit test cases in 3.0 branch (#6598)
    
    * fix: fix ut in 3.0 version
    
    * fix(registry): fix ut in 3.0 version
    
    * fix(remoting): fix ut in 3.0 version
    
    * fix: fix Dynamic Directory cause NPE
    
    * fix(registry): fix ut in 3.0 version
    
    * fix(config-api): fix ut in 3.0 version
    
    * fix(registry): add mock MulticastServiceDiscovery to support ut
    
    * fix: fix MigrationInvoker cause NPE
    
    * fix: add MockServiceDiscovery to dubbo-config-spring
    
    * fix: add retry support for MulticastRegistryTest
    
    * fix: remove snapshot version for ci
    
    * fix: add PublishMetadata to command list
    
    * fix: restore snapshot version
    
    * fix: make MulticastRegistryTest retryable
    
    * fix: reduce static reference effect
    
    * fix: exclude mockito spi files
    
    * restore ignored extension
    
    * fix: fix testcontainer init
    
    * Revert "fix: fix testcontainer init"
    
    This reverts commit 2c771567
    
    * Revert "restore ignored extension"
    
    This reverts commit 492c5cac
    
    * fix: fix MulticastRegistryTest registry not available in time
    
    * style: restore crlf
    
    * style: restore crlf
    
    * style: restore crlf
    
    * style: restore crlf
    
    * style: restore crlf
    
    * style: restore crlf
    
    * style: restore crlf
    
    * style: pretty code
    
    * style: pretty code
---
 .../support/AbstractClusterInvokerTest.java        | 11 ++--
 .../support/wrapper/MockClusterInvokerTest.java    | 42 +++++++++++--
 .../wrapper/MockProviderRpcExceptionTest.java      |  8 ++-
 .../org/apache/dubbo/config/ServiceConfig.java     |  7 ++-
 .../dubbo/config/AbstractInterfaceConfigTest.java  |  3 +
 .../dubbo/config/bootstrap/DubboBootstrapTest.java |  4 +-
 .../PublishingServiceDefinitionListenerTest.java   | 22 ++-----
 .../dubbo/config/mock/MockServiceDiscovery.java    | 69 +++++++++++++++++++++
 .../metadata/MetadataServiceExporterTest.java      | 32 +++++++++-
 ...g.apache.dubbo.registry.client.ServiceDiscovery |  1 +
 .../spring/registry/MockServiceDiscovery.java      | 69 +++++++++++++++++++++
 ...g.apache.dubbo.registry.client.ServiceDiscovery |  1 +
 dubbo-dependencies-bom/pom.xml                     |  2 +-
 .../dubbo/qos/command/util/CommandHelperTest.java  |  4 +-
 .../registry/integration/DynamicDirectory.java     |  2 +-
 .../InterfaceCompatibleRegistryProtocol.java       |  8 ++-
 .../registry/client/InMemoryServiceDiscovery.java  |  9 ++-
 .../support/ServiceOrientedRegistryTest.java       |  5 ++
 .../registry/dubbo/RegistryDirectoryTest.java      | 29 ++++++---
 .../dubbo/registry/dubbo/RegistryProtocolTest.java |  6 +-
 .../registry/dubbo/RegistryStatusCheckerTest.java  |  6 +-
 .../multicast/MulticastServiceDiscovery.java       | 72 ++++++++++++++++++++++
 .../MulticastServiceDiscoveryFactory.java          | 27 +++-----
 ...g.apache.dubbo.registry.client.ServiceDiscovery |  1 +
 ...e.dubbo.registry.client.ServiceDiscoveryFactory |  1 +
 .../registry/multicast/MulticastRegistryTest.java  | 20 +++---
 dubbo-registry/pom.xml                             |  7 ++-
 .../remoting/transport/grizzly/GrizzlyServer.java  | 12 ++--
 .../transport/grizzly/GrizzlyTransporterTest.java  |  2 +-
 .../support/header/HeartbeatHandlerTest.java       | 45 ++++++++++----
 .../transport/netty/ClientReconnectTest.java       |  5 +-
 .../remoting/transport/netty/ThreadNameTest.java   |  4 +-
 .../transport/netty4/NettyTransporterTest.java     |  4 +-
 .../transport/netty4/ReplierDispatcherTest.java    | 13 ++--
 .../support/MulticastExchangeNetworkerTest.java    | 12 ++--
 .../remoting/p2p/support/FileNetworkerTest.java    |  4 +-
 .../p2p/support/MulticastNetworkerTest.java        |  5 +-
 pom.xml                                            |  2 +
 38 files changed, 447 insertions(+), 129 deletions(-)

diff --git 
a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java
 
b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java
index 5300058..33e863b 100644
--- 
a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java
+++ 
b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java
@@ -19,7 +19,6 @@ package org.apache.dubbo.rpc.cluster.support;
 import org.apache.dubbo.common.URL;
 import org.apache.dubbo.common.extension.ExtensionLoader;
 import org.apache.dubbo.common.utils.NetUtils;
-import org.apache.dubbo.common.utils.StringUtils;
 import org.apache.dubbo.rpc.Invocation;
 import org.apache.dubbo.rpc.Invoker;
 import org.apache.dubbo.rpc.Result;
@@ -47,10 +46,8 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
-import static org.apache.dubbo.common.constants.CommonConstants.MONITOR_KEY;
 import static 
org.apache.dubbo.rpc.cluster.Constants.CLUSTER_AVAILABLE_CHECK_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.INVOCATION_NEED_MOCK;
-import static org.apache.dubbo.rpc.cluster.Constants.REFER_KEY;
 import static org.mockito.BDDMockito.given;
 import static org.mockito.Mockito.mock;
 
@@ -66,6 +63,7 @@ public class AbstractClusterInvokerTest {
     StaticDirectory<IHelloService> dic;
     RpcInvocation invocation = new RpcInvocation();
     URL url = 
URL.valueOf("registry://localhost:9090/org.apache.dubbo.rpc.cluster.support.AbstractClusterInvokerTest.IHelloService?refer="
 + URL.encode("application=abstractClusterInvokerTest"));
+    URL consumerUrl = 
URL.valueOf("dubbo://localhost:9090?application=abstractClusterInvokerTest");
 
     Invoker<IHelloService> invoker1;
     Invoker<IHelloService> invoker2;
@@ -123,7 +121,8 @@ public class AbstractClusterInvokerTest {
         
given(mockedInvoker1.getUrl()).willReturn(turl.setPort(999).setProtocol("mock"));
 
         invokers.add(invoker1);
-        dic = new StaticDirectory<IHelloService>(url, invokers, null);
+        dic = new StaticDirectory<>(url, invokers, null);
+        dic.setConsumerUrl(consumerUrl);
         cluster = new AbstractClusterInvoker(dic) {
             @Override
             protected Result doInvoke(Invocation invocation, List invokers, 
LoadBalance loadbalance)
@@ -226,9 +225,7 @@ public class AbstractClusterInvokerTest {
     @Test
     public void testCloseAvailablecheck() {
         LoadBalance lb = mock(LoadBalance.class);
-        Map<String, String> queryMap = 
StringUtils.parseQueryString(url.getParameterAndDecoded(REFER_KEY));
-        URL tmpUrl = 
url.addParameters(queryMap).removeParameter(REFER_KEY).removeParameter(MONITOR_KEY);
-        given(lb.select(invokers, tmpUrl, invocation)).willReturn(invoker1);
+        given(lb.select(invokers, consumerUrl, 
invocation)).willReturn(invoker1);
         initlistsize5();
 
         Invoker sinvoker = cluster_nocheck.select(lb, invocation, invokers, 
selectedInvokers);
diff --git 
a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java
 
b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java
index feff78e..df1240c 100644
--- 
a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java
+++ 
b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java
@@ -38,7 +38,9 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import static org.apache.dubbo.common.constants.CommonConstants.PATH_KEY;
 import static org.apache.dubbo.rpc.Constants.MOCK_KEY;
+import static org.apache.dubbo.rpc.cluster.Constants.REFER_KEY;
 
 public class MockClusterInvokerTest {
 
@@ -55,7 +57,8 @@ public class MockClusterInvokerTest {
     @Test
     public void testMockInvokerInvoke_normal() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName());
-        url = url.addParameter(MOCK_KEY, "fail");
+        url = url.addParameter(MOCK_KEY, "fail")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()));
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         URL mockUrl = URL.valueOf("mock://localhost/" + 
IHelloService.class.getName()
                 + "?getSomething.mock=return aa");
@@ -84,6 +87,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerInvoke_failmock() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter(MOCK_KEY, "fail:return null")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         URL mockUrl = URL.valueOf("mock://localhost/" + 
IHelloService.class.getName()
                 + "?getSomething.mock=return 
aa").addParameters(url.getParameters());
@@ -118,7 +122,8 @@ public class MockClusterInvokerTest {
     @Test
     public void testMockInvokerInvoke_forcemock() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName());
-        url = url.addParameter(MOCK_KEY, "force:return null");
+        url = url.addParameter(MOCK_KEY, "force:return null")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()));
 
         URL mockUrl = URL.valueOf("mock://localhost/" + 
IHelloService.class.getName()
                 + "?getSomething.mock=return aa&getSomething3xx.mock=return 
xx")
@@ -150,7 +155,9 @@ public class MockClusterInvokerTest {
     @Test
     public void testMockInvokerInvoke_forcemock_defaultreturn() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName());
-        url = url.addParameter(MOCK_KEY, "force");
+        url = url.addParameter(MOCK_KEY, "force")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()));
+
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         URL mockUrl = URL.valueOf("mock://localhost/" + 
IHelloService.class.getName()
                 + "?getSomething.mock=return aa&getSomething3xx.mock=return 
xx&sayHello.mock=return ")
@@ -173,7 +180,8 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_Fock_someMethods() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("getSomething.mock", "fail:return x")
-                .addParameter("getSomething2.mock", "force:return y");
+                .addParameter("getSomething2.mock", "force:return y")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()));
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
         RpcInvocation invocation = new RpcInvocation();
@@ -208,6 +216,7 @@ public class MockClusterInvokerTest {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("getSomething.mock", "fail:return x")
                 .addParameter("getSomething2.mock", "force:return y")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -242,6 +251,7 @@ public class MockClusterInvokerTest {
                 .addParameter("mock", "fail:return null")
                 .addParameter("getSomething.mock", "fail:return x")
                 .addParameter("getSomething2.mock", "force:return y")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -278,6 +288,7 @@ public class MockClusterInvokerTest {
                 .addParameter("mock", "fail:return z")
                 .addParameter("getSomething.mock", "fail:return x")
                 .addParameter("getSomething2.mock", "force:return y")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -314,6 +325,7 @@ public class MockClusterInvokerTest {
                 .addParameter("mock", "force:return z")
                 .addParameter("getSomething.mock", "fail:return x")
                 .addParameter("getSomething2.mock", "force:return y")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -348,6 +360,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_Fock_Default() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("mock", "fail:return x")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -376,6 +389,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_checkCompatible_return() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("getSomething.mock", "return x")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -402,6 +416,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("mock", "true")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -418,6 +433,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock2() 
{
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("mock", "fail")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -433,6 +449,7 @@ public class MockClusterInvokerTest {
     @Test
     public void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock3() 
{
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("mock", "force");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -446,6 +463,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_check_String() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("getSomething.mock", "force:return 1688")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -459,6 +477,7 @@ public class MockClusterInvokerTest {
     @Test
     public void testMockInvokerFromOverride_Invoke_check_int() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("getInt1.mock", "force:return 1688")
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
@@ -473,6 +492,7 @@ public class MockClusterInvokerTest {
     @Test
     public void testMockInvokerFromOverride_Invoke_check_boolean() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("getBoolean1.mock", "force:return true")
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
@@ -487,6 +507,7 @@ public class MockClusterInvokerTest {
     @Test
     public void testMockInvokerFromOverride_Invoke_check_Boolean() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("getBoolean2.mock", "force:return true")
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
@@ -502,6 +523,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_check_ListString_empty() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("getListString.mock", "force:return empty")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -516,6 +538,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_check_ListString() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("getListString.mock", "force:return 
[\"hi\",\"hi2\"]")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -532,6 +555,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_check_ListPojo_empty() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("getUsers.mock", "force:return empty")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -546,6 +570,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_check_ListPojo() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("getUsers.mock", "force:return [{id:1, 
name:\"hi1\"}, {id:2, name:\"hi2\"}]")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -562,6 +587,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_check_ListPojo_error() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("getUsers.mock", "force:return [{id:x, 
name:\"hi1\"}]")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -577,6 +603,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_force_throw() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("getBoolean2.mock", "force:throw ")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -594,6 +621,7 @@ public class MockClusterInvokerTest {
     public void 
testMockInvokerFromOverride_Invoke_force_throwCustemException() throws 
Throwable {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("getBoolean2.mock", "force:throw 
org.apache.dubbo.rpc.cluster.support.wrapper.MyMockException")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -611,6 +639,7 @@ public class MockClusterInvokerTest {
     public void 
testMockInvokerFromOverride_Invoke_force_throwCustemExceptionNotFound() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("getBoolean2.mock", "force:throw 
java.lang.RuntimeException2")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -628,6 +657,7 @@ public class MockClusterInvokerTest {
     public void testMockInvokerFromOverride_Invoke_mock_false() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloService.class.getName())
                 .addParameter("mock", "false")
+                .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + 
IHelloService.class.getName()))
                 .addParameter("invoke_return_error", "true");
         Invoker<IHelloService> cluster = getClusterInvoker(url);
         //Configured with mock
@@ -708,7 +738,7 @@ public class MockClusterInvokerTest {
             return "something3";
         }
 
-        public String getSomething4(){
+        public String getSomething4() {
             throw new RpcException("getSomething4|RpcException");
         }
 
@@ -754,7 +784,7 @@ public class MockClusterInvokerTest {
             return "something3mock";
         }
 
-        public String getSomething4(){
+        public String getSomething4() {
             return "something4mock";
         }
 
diff --git 
a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockProviderRpcExceptionTest.java
 
b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockProviderRpcExceptionTest.java
index 39459fb..6a46312 100644
--- 
a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockProviderRpcExceptionTest.java
+++ 
b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockProviderRpcExceptionTest.java
@@ -37,6 +37,7 @@ import java.util.Arrays;
 import java.util.List;
 
 import static org.apache.dubbo.rpc.Constants.MOCK_KEY;
+import static org.apache.dubbo.rpc.cluster.Constants.REFER_KEY;
 
 public class MockProviderRpcExceptionTest {
 
@@ -53,7 +54,8 @@ public class MockProviderRpcExceptionTest {
     @Test
     public void testMockInvokerProviderRpcException() {
         URL url = URL.valueOf("remote://1.2.3.4/" + 
IHelloRpcService.class.getName());
-        url = url.addParameter(MOCK_KEY, 
"true").addParameter("invoke_return_error", "true");
+        url = url.addParameter(MOCK_KEY, 
"true").addParameter("invoke_return_error", "true")
+                .addParameter(REFER_KEY, 
"path%3dorg.apache.dubbo.rpc.cluster.support.wrapper.MockProviderRpcExceptionTest%24IHelloRpcService");
         Invoker<IHelloRpcService> cluster = getClusterInvoker(url);
         RpcInvocation invocation = new RpcInvocation();
         invocation.setMethodName("getSomething4");
@@ -130,7 +132,7 @@ public class MockProviderRpcExceptionTest {
             return "something3";
         }
 
-        public String getSomething4(){
+        public String getSomething4() {
             throw new RpcException("getSomething4|RpcException");
         }
 
@@ -176,7 +178,7 @@ public class MockProviderRpcExceptionTest {
             return "something3mock";
         }
 
-        public String getSomething4(){
+        public String getSomething4() {
             return "something4mock";
         }
 
diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
index 37972c1..356a897 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
@@ -213,7 +213,8 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
     public void exported() {
         List<URL> exportedURLs = this.getExportedUrls();
         exportedURLs.forEach(url -> {
-            
ServiceNameMapping.getExtension(getApplication().getParameters().get(MAPPING_KEY)).map(url);
+            Map<String, String> parameters = getApplication().getParameters();
+            ServiceNameMapping.getExtension(parameters != null ? 
parameters.get(MAPPING_KEY) : null).map(url);
         });
         // dispatch a ServiceConfigExportedEvent since 2.7.4
         dispatch(new ServiceConfigExportedEvent(this));
@@ -430,7 +431,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
         /**
          * Here the token value configured by the provider is used to assign 
the value to ServiceConfig#token
          */
-        if(ConfigUtils.isEmpty(token) && provider != null) {
+        if (ConfigUtils.isEmpty(token) && provider != null) {
             token = provider.getToken();
         }
 
@@ -705,7 +706,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
     }
 
     private void postProcessConfig() {
-        List<ConfigPostProcessor> configPostProcessors 
=ExtensionLoader.getExtensionLoader(ConfigPostProcessor.class)
+        List<ConfigPostProcessor> configPostProcessors = 
ExtensionLoader.getExtensionLoader(ConfigPostProcessor.class)
                 .getActivateExtension(URL.valueOf("configPostProcessor://"), 
(String[]) null);
         configPostProcessors.forEach(component -> 
component.postProcessServiceConfig(this));
     }
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractInterfaceConfigTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractInterfaceConfigTest.java
index 2bcd960..3a4a83c 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractInterfaceConfigTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractInterfaceConfigTest.java
@@ -24,6 +24,7 @@ import org.apache.dubbo.config.mock.GreetingLocal3;
 import org.apache.dubbo.config.mock.GreetingMock1;
 import org.apache.dubbo.config.mock.GreetingMock2;
 import org.apache.dubbo.config.utils.ConfigValidationUtils;
+import org.apache.dubbo.rpc.model.ApplicationModel;
 
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.AfterEach;
@@ -41,12 +42,14 @@ public class AbstractInterfaceConfigTest {
 
     @BeforeAll
     public static void setUp(@TempDir Path folder) {
+        ApplicationModel.reset();
         dubboProperties = 
folder.resolve(CommonConstants.DUBBO_PROPERTIES_KEY).toFile();
         System.setProperty(CommonConstants.DUBBO_PROPERTIES_KEY, 
dubboProperties.getAbsolutePath());
     }
 
     @AfterAll
     public static void tearDown() {
+        ApplicationModel.reset();
         System.clearProperty(CommonConstants.DUBBO_PROPERTIES_KEY);
     }
 
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboBootstrapTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboBootstrapTest.java
index 6136dd4..e329f23 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboBootstrapTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboBootstrapTest.java
@@ -25,6 +25,7 @@ import org.apache.dubbo.config.MonitorConfig;
 import org.apache.dubbo.config.utils.ConfigValidationUtils;
 import org.apache.dubbo.monitor.MonitorService;
 import org.apache.dubbo.registry.RegistryService;
+import org.apache.dubbo.rpc.model.ApplicationModel;
 
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
@@ -55,13 +56,14 @@ public class DubboBootstrapTest {
 
     @BeforeAll
     public static void setUp(@TempDir Path folder) {
+        ApplicationModel.reset();
         dubboProperties = 
folder.resolve(CommonConstants.DUBBO_PROPERTIES_KEY).toFile();
         System.setProperty(CommonConstants.DUBBO_PROPERTIES_KEY, 
dubboProperties.getAbsolutePath());
     }
 
     @AfterEach
     public void tearDown() throws IOException {
-
+        ApplicationModel.reset();
     }
 
     @Test
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/event/listener/PublishingServiceDefinitionListenerTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/event/listener/PublishingServiceDefinitionListenerTest.java
index e7e5376..3190f34 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/event/listener/PublishingServiceDefinitionListenerTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/event/listener/PublishingServiceDefinitionListenerTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.dubbo.config.event.listener;
 
-import org.apache.dubbo.common.URL;
 import org.apache.dubbo.config.ApplicationConfig;
 import org.apache.dubbo.config.RegistryConfig;
 import org.apache.dubbo.config.ServiceConfig;
@@ -25,7 +24,8 @@ import org.apache.dubbo.config.bootstrap.EchoServiceImpl;
 import org.apache.dubbo.config.context.ConfigManager;
 import org.apache.dubbo.config.event.ServiceConfigExportedEvent;
 import org.apache.dubbo.metadata.WritableMetadataService;
-import org.apache.dubbo.metadata.definition.model.FullServiceDefinition;
+import org.apache.dubbo.metadata.definition.ServiceDefinitionBuilder;
+import org.apache.dubbo.metadata.definition.model.ServiceDefinition;
 import org.apache.dubbo.rpc.model.ApplicationModel;
 
 import com.google.gson.Gson;
@@ -33,14 +33,7 @@ import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-import java.util.List;
-
 import static 
org.apache.dubbo.common.constants.CommonConstants.DEFAULT_METADATA_STORAGE_TYPE;
-import static org.apache.dubbo.common.constants.CommonConstants.PID_KEY;
-import static org.apache.dubbo.common.constants.CommonConstants.TIMESTAMP_KEY;
-import static 
org.apache.dubbo.metadata.definition.ServiceDefinitionBuilder.buildFullDefinition;
-import static org.apache.dubbo.remoting.Constants.BIND_IP_KEY;
-import static org.apache.dubbo.remoting.Constants.BIND_PORT_KEY;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
@@ -80,15 +73,8 @@ public class PublishingServiceDefinitionListenerTest {
 
         String serviceDefinition = 
writableMetadataService.getServiceDefinition(EchoService.class.getName());
 
-        List<URL> exportedUrls = serviceConfig.getExportedUrls();
-
-        FullServiceDefinition fullServiceDefinition = buildFullDefinition(
-                serviceConfig.getInterfaceClass(),
-                exportedUrls.get(0)
-                        .removeParameters(PID_KEY, TIMESTAMP_KEY, BIND_IP_KEY, 
BIND_PORT_KEY, TIMESTAMP_KEY)
-                        .getParameters()
-        );
+        ServiceDefinition serviceDefinitionBuild = 
ServiceDefinitionBuilder.build(serviceConfig.getInterfaceClass());
 
-        assertEquals(serviceDefinition, new 
Gson().toJson(fullServiceDefinition));
+        assertEquals(serviceDefinition, new 
Gson().toJson(serviceDefinitionBuild));
     }
 }
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/mock/MockServiceDiscovery.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/mock/MockServiceDiscovery.java
new file mode 100644
index 0000000..33f1a16
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/mock/MockServiceDiscovery.java
@@ -0,0 +1,69 @@
+/*
+ * 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.config.mock;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.registry.client.ServiceDiscovery;
+import org.apache.dubbo.registry.client.ServiceInstance;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class MockServiceDiscovery implements ServiceDiscovery {
+    private URL registryURL;
+    private ServiceInstance serviceInstance;
+
+    @Override
+    public void initialize(URL registryURL) throws Exception {
+        this.registryURL = registryURL;
+    }
+
+    @Override
+    public void destroy() throws Exception {
+
+    }
+
+    @Override
+    public void register(ServiceInstance serviceInstance) throws 
RuntimeException {
+        this.serviceInstance = serviceInstance;
+    }
+
+    @Override
+    public void update(ServiceInstance serviceInstance) throws 
RuntimeException {
+        this.serviceInstance = serviceInstance;
+    }
+
+    @Override
+    public void unregister(ServiceInstance serviceInstance) throws 
RuntimeException {
+        this.serviceInstance = null;
+    }
+
+    @Override
+    public Set<String> getServices() {
+        return new HashSet<>();
+    }
+
+    @Override
+    public URL getUrl() {
+        return registryURL;
+    }
+
+    @Override
+    public ServiceInstance getLocalInstance() {
+        return serviceInstance;
+    }
+}
diff --git 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/metadata/MetadataServiceExporterTest.java
 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/metadata/MetadataServiceExporterTest.java
index 8096276..811b8a9 100644
--- 
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/metadata/MetadataServiceExporterTest.java
+++ 
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/metadata/MetadataServiceExporterTest.java
@@ -16,12 +16,20 @@
  */
 package org.apache.dubbo.metadata;
 
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ProtocolConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.metadata.ConfigurableMetadataServiceExporter;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
 
 import static 
org.apache.dubbo.common.constants.CommonConstants.COMPOSITE_METADATA_STORAGE_TYPE;
 import static 
org.apache.dubbo.common.constants.CommonConstants.DEFAULT_METADATA_STORAGE_TYPE;
 import static 
org.apache.dubbo.common.constants.CommonConstants.REMOTE_METADATA_STORAGE_TYPE;
-import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
@@ -31,10 +39,28 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  */
 public class MetadataServiceExporterTest {
 
+    @BeforeAll
+    public static void init() {
+        ApplicationModel.getConfigManager().setApplication(new 
ApplicationConfig("Test"));
+        ApplicationModel.getConfigManager().addRegistry(new 
RegistryConfig("test://1.2.3.4"));
+        ApplicationModel.getConfigManager().addProtocol(new 
ProtocolConfig("injvm"));
+    }
+
+    @AfterAll
+    public static void destroy() {
+        ApplicationModel.getConfigManager().setApplication(null);
+        ApplicationModel.reset();
+    }
+
     @Test
     public void test() {
-        MetadataServiceExporter exporter = 
MetadataServiceExporter.getExtension(null);
-        assertEquals(exporter, MetadataServiceExporter.getDefaultExtension());
+        MetadataService metadataService = Mockito.mock(MetadataService.class);
+        MetadataServiceExporter exporter = new 
ConfigurableMetadataServiceExporter(metadataService);
+
+        exporter.export();
+        assertTrue(exporter.isExported());
+        exporter.unexport();
+
         assertTrue(exporter.supports(DEFAULT_METADATA_STORAGE_TYPE));
         assertTrue(exporter.supports(REMOTE_METADATA_STORAGE_TYPE));
         assertTrue(exporter.supports(COMPOSITE_METADATA_STORAGE_TYPE));
diff --git 
a/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/org.apache.dubbo.registry.client.ServiceDiscovery
 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/org.apache.dubbo.registry.client.ServiceDiscovery
new file mode 100644
index 0000000..22ceb16
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-api/src/test/resources/META-INF/services/org.apache.dubbo.registry.client.ServiceDiscovery
@@ -0,0 +1 @@
+mockregistry=org.apache.dubbo.config.mock.MockServiceDiscovery
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registry/MockServiceDiscovery.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registry/MockServiceDiscovery.java
new file mode 100644
index 0000000..1511b0e
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registry/MockServiceDiscovery.java
@@ -0,0 +1,69 @@
+/*
+ * 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.config.spring.registry;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.registry.client.ServiceDiscovery;
+import org.apache.dubbo.registry.client.ServiceInstance;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class MockServiceDiscovery implements ServiceDiscovery {
+    private URL registryURL;
+    private ServiceInstance serviceInstance;
+
+    @Override
+    public void initialize(URL registryURL) throws Exception {
+        this.registryURL = registryURL;
+    }
+
+    @Override
+    public void destroy() throws Exception {
+
+    }
+
+    @Override
+    public void register(ServiceInstance serviceInstance) throws 
RuntimeException {
+        this.serviceInstance = serviceInstance;
+    }
+
+    @Override
+    public void update(ServiceInstance serviceInstance) throws 
RuntimeException {
+        this.serviceInstance = serviceInstance;
+    }
+
+    @Override
+    public void unregister(ServiceInstance serviceInstance) throws 
RuntimeException {
+        this.serviceInstance = null;
+    }
+
+    @Override
+    public Set<String> getServices() {
+        return new HashSet<>();
+    }
+
+    @Override
+    public URL getUrl() {
+        return registryURL;
+    }
+
+    @Override
+    public ServiceInstance getLocalInstance() {
+        return serviceInstance;
+    }
+}
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscovery
 
b/dubbo-config/dubbo-config-spring/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscovery
new file mode 100644
index 0000000..cea6b84
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-spring/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscovery
@@ -0,0 +1 @@
+mock=org.apache.dubbo.config.spring.registry.MockServiceDiscovery
\ No newline at end of file
diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml
index 46d0ce2..200e8e2 100644
--- a/dubbo-dependencies-bom/pom.xml
+++ b/dubbo-dependencies-bom/pom.xml
@@ -94,7 +94,7 @@
         <netty_version>3.2.5.Final</netty_version>
         <netty4_version>4.1.51.Final</netty4_version>
         <mina_version>1.1.7</mina_version>
-        <grizzly_version>2.1.4</grizzly_version>
+        <grizzly_version>2.4.4</grizzly_version>
         <httpclient_version>4.5.3</httpclient_version>
         <httpcore_version>4.4.6</httpcore_version>
         <fastjson_version>1.2.70</fastjson_version>
diff --git 
a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/util/CommandHelperTest.java
 
b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/util/CommandHelperTest.java
index 812d5c7..20cd04b 100644
--- 
a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/util/CommandHelperTest.java
+++ 
b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/util/CommandHelperTest.java
@@ -21,9 +21,11 @@ import org.apache.dubbo.qos.command.impl.Help;
 import org.apache.dubbo.qos.command.impl.Ls;
 import org.apache.dubbo.qos.command.impl.Offline;
 import org.apache.dubbo.qos.command.impl.Online;
+import org.apache.dubbo.qos.command.impl.PublishMetadata;
 import org.apache.dubbo.qos.command.impl.Quit;
 import org.apache.dubbo.qos.command.impl.Ready;
 import org.apache.dubbo.qos.command.impl.Version;
+
 import org.junit.jupiter.api.Test;
 
 import java.util.List;
@@ -47,7 +49,7 @@ public class CommandHelperTest {
         List<Class<?>> classes = CommandHelper.getAllCommandClass();
         assertThat(classes,
                 containsInAnyOrder(GreetingCommand.class, Help.class, 
Ls.class, Offline.class, Online.class, Quit.class,
-                        Ready.class, Version.class));
+                        Ready.class, Version.class, PublishMetadata.class));
     }
 
     @Test
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/DynamicDirectory.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/DynamicDirectory.java
index a53378c..d97c276 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/DynamicDirectory.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/DynamicDirectory.java
@@ -126,7 +126,7 @@ public abstract class DynamicDirectory<T> extends 
AbstractDirectory<T> implement
 
     private URL turnRegistryUrlToConsumerUrl(URL url) {
         return URLBuilder.from(url)
-                .setHost(queryMap.get(REGISTER_IP_KEY))
+                .setHost(queryMap.get(REGISTER_IP_KEY) == null ? url.getHost() 
: queryMap.get(REGISTER_IP_KEY))
                 .setPort(0)
                 .setProtocol(queryMap.get(PROTOCOL_KEY) == null ? DUBBO : 
queryMap.get(PROTOCOL_KEY))
                 .setPath(queryMap.get(INTERFACE_KEY))
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/InterfaceCompatibleRegistryProtocol.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/InterfaceCompatibleRegistryProtocol.java
index d591e02..9bc0bd4 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/InterfaceCompatibleRegistryProtocol.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/InterfaceCompatibleRegistryProtocol.java
@@ -154,8 +154,12 @@ public class InterfaceCompatibleRegistryProtocol extends 
RegistryProtocol {
 
         @Override
         public void destroy() {
-            invoker.destroy();
-            serviceDiscoveryInvoker.destroy();
+            if (invoker != null) {
+                invoker.destroy();
+            }
+            if (serviceDiscoveryInvoker != null) {
+                serviceDiscoveryInvoker.destroy();
+            }
         }
 
         @Override
diff --git 
a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/InMemoryServiceDiscovery.java
 
b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/InMemoryServiceDiscovery.java
index 93043ba..20eeed3 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/InMemoryServiceDiscovery.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/InMemoryServiceDiscovery.java
@@ -44,6 +44,8 @@ public class InMemoryServiceDiscovery implements 
ServiceDiscovery {
 
     private ServiceInstance serviceInstance;
 
+    private URL registryURL;
+
     @Override
     public Set<String> getServices() {
         return repository.keySet();
@@ -71,6 +73,11 @@ public class InMemoryServiceDiscovery implements 
ServiceDiscovery {
     }
 
     @Override
+    public URL getUrl() {
+        return registryURL;
+    }
+
+    @Override
     public ServiceInstance getLocalInstance() {
         return serviceInstance;
     }
@@ -104,7 +111,7 @@ public class InMemoryServiceDiscovery implements 
ServiceDiscovery {
 
     @Override
     public void initialize(URL registryURL) throws Exception {
-
+        this.registryURL = registryURL;
     }
 
     @Override
diff --git 
a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/ServiceOrientedRegistryTest.java
 
b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/ServiceOrientedRegistryTest.java
index e65a271..bc0906f 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/ServiceOrientedRegistryTest.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/ServiceOrientedRegistryTest.java
@@ -18,9 +18,11 @@ package org.apache.dubbo.registry.support;
 
 import org.apache.dubbo.common.URL;
 import org.apache.dubbo.common.utils.CollectionUtils;
+import org.apache.dubbo.config.ApplicationConfig;
 import org.apache.dubbo.metadata.WritableMetadataService;
 import org.apache.dubbo.registry.NotifyListener;
 import org.apache.dubbo.registry.client.ServiceDiscoveryRegistry;
+import org.apache.dubbo.rpc.model.ApplicationModel;
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -38,6 +40,7 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_TYPE_KEY;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.SERVICE_REGISTRY_TYPE;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.SUBSCRIBED_SERVICE_NAMES_KEY;
+import static org.apache.dubbo.rpc.Constants.ID_KEY;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -51,6 +54,7 @@ public class ServiceOrientedRegistryTest {
 
     private static final URL registryURL = 
valueOf("in-memory://localhost:12345")
             .addParameter(REGISTRY_TYPE_KEY, SERVICE_REGISTRY_TYPE)
+            .addParameter(ID_KEY, "org.apache.dubbo.config.RegistryConfig#0")
             .addParameter(SUBSCRIBED_SERVICE_NAMES_KEY, "a, b , c,d,e ,");
 
     private static final String SERVICE_INTERFACE = 
"org.apache.dubbo.metadata.MetadataService";
@@ -81,6 +85,7 @@ public class ServiceOrientedRegistryTest {
         registry = ServiceDiscoveryRegistry.create(registryURL);
         metadataService = WritableMetadataService.getDefaultExtension();
         notifyListener = new MyNotifyListener();
+        ApplicationModel.getConfigManager().setApplication(new 
ApplicationConfig("Test"));
     }
 
     @Test
diff --git 
a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java
 
b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java
index 9cc954e..030c427 100644
--- 
a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java
+++ 
b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java
@@ -17,6 +17,7 @@
 package org.apache.dubbo.registry.dubbo;
 
 import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.URLBuilder;
 import org.apache.dubbo.common.extension.ExtensionLoader;
 import org.apache.dubbo.common.utils.LogUtil;
 import org.apache.dubbo.common.utils.NetUtils;
@@ -35,6 +36,7 @@ import 
org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalance;
 import org.apache.dubbo.rpc.cluster.router.script.ScriptRouterFactory;
 import org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker;
 import org.apache.dubbo.rpc.model.ApplicationModel;
+import org.apache.dubbo.rpc.protocol.InvokerWrapper;
 import org.apache.dubbo.rpc.service.GenericService;
 
 import org.junit.jupiter.api.Assertions;
@@ -56,6 +58,7 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE;
 import static 
org.apache.dubbo.common.constants.CommonConstants.APPLICATION_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE;
 import static org.apache.dubbo.common.constants.CommonConstants.DISABLED_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.DUBBO;
 import static org.apache.dubbo.common.constants.CommonConstants.ENABLED_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.LOADBALANCE_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
@@ -138,14 +141,20 @@ public class RegistryDirectoryTest {
 
     @Test
     public void test_Constructor_CheckStatus() throws Exception {
-        URL url = URL.valueOf("notsupported://10.20.30.40/" + service + 
"?a=b").addParameterAndEncoded(REFER_KEY,
-                "foo=bar");
+        URL url = URL.valueOf("notsupported://10.20.30.40/" + service + 
"?a=b").addParameterAndEncoded(REFER_KEY, "foo=bar");
         RegistryDirectory reg = getRegistryDirectory(url);
-        Field field = reg.getClass().getDeclaredField("queryMap");
+        Field field = 
reg.getClass().getSuperclass().getSuperclass().getDeclaredField("queryMap");
         field.setAccessible(true);
         Map<String, String> queryMap = (Map<String, String>) field.get(reg);
         Assertions.assertEquals("bar", queryMap.get("foo"));
-        Assertions.assertEquals(url.clearParameters().addParameter("foo", 
"bar"), reg.getConsumerUrl());
+        URL consumerUrl = URLBuilder.from(url)
+                .setPort(0)
+                .setProtocol(DUBBO)
+                .setPath(null)
+                .clearParameters()
+                .addParameters(queryMap)
+                .build();
+        Assertions.assertEquals(consumerUrl, reg.getConsumerUrl());
     }
 
     @Test
@@ -413,7 +422,7 @@ public class RegistryDirectoryTest {
             serviceUrls.add(SERVICEURL.addParameter(MOCK_KEY, "true"));
             registryDirectory2.notify(serviceUrls);
 
-            Assertions.assertEquals("true", 
registryDirectory2.getConsumerUrl().getParameter("mock"));
+            Assertions.assertEquals("true", ((InvokerWrapper<?>) 
registryDirectory2.getInvokers().get(0)).getUrl().getParameter("mock"));
         }
     }
 
@@ -484,7 +493,7 @@ public class RegistryDirectoryTest {
         registryDirectory.notify(serviceUrls);
 
         // Object $invoke(String method, String[] parameterTypes, Object[] 
args) throws GenericException;
-        invocation = new RpcInvocation($INVOKE, 
GenericService.class.getName(), new Class[]{String.class, String[].class, 
Object[].class},
+        invocation = new RpcInvocation($INVOKE, 
GenericService.class.getName(), "", new Class[]{String.class, String[].class, 
Object[].class},
                 new Object[]{"getXXX1", "", new Object[]{}});
 
         List<Invoker> invokers = registryDirectory.list(invocation);
@@ -511,7 +520,7 @@ public class RegistryDirectoryTest {
 
         registryDirectory.notify(serviceUrls);
 
-        invocation = new RpcInvocation($INVOKE, GenericService.class.getName(),
+        invocation = new RpcInvocation($INVOKE, 
GenericService.class.getName(), "",
                 new Class[]{String.class, String[].class, Object[].class},
                 new Object[]{"getXXX1", new String[]{"Enum"}, new 
Object[]{Param.MORGAN}});
 
@@ -783,7 +792,7 @@ public class RegistryDirectoryTest {
         List<URL> durls = new ArrayList<URL>();
         durls.add(SERVICEURL.setHost("10.20.30.140").addParameter("timeout", 
"1"));
         registryDirectory.notify(durls);
-        
Assertions.assertNull(registryDirectory.getConsumerUrl().getParameter("mock"));
+        Assertions.assertNull(((InvokerWrapper<?>) 
registryDirectory.getInvokers().get(0)).getUrl().getParameter("mock"));
 
         //override
         durls = new ArrayList<URL>();
@@ -792,7 +801,7 @@ public class RegistryDirectoryTest {
         List<Invoker<?>> invokers = registryDirectory.list(invocation);
         Invoker<?> aInvoker = invokers.get(0);
         Assertions.assertEquals("1000", 
aInvoker.getUrl().getParameter("timeout"));
-        Assertions.assertEquals("fail", 
registryDirectory.getConsumerUrl().getParameter("mock"));
+        Assertions.assertEquals("fail", ((InvokerWrapper<?>) 
registryDirectory.getInvokers().get(0)).getUrl().getParameter("mock"));
 
         //override clean
         durls = new ArrayList<URL>();
@@ -803,7 +812,7 @@ public class RegistryDirectoryTest {
         //Need to be restored to the original providerUrl
         Assertions.assertEquals("1", 
aInvoker.getUrl().getParameter("timeout"));
 
-        
Assertions.assertNull(registryDirectory.getConsumerUrl().getParameter("mock"));
+        Assertions.assertNull(((InvokerWrapper<?>) 
registryDirectory.getInvokers().get(0)).getUrl().getParameter("mock"));
     }
 
     /**
diff --git 
a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryProtocolTest.java
 
b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryProtocolTest.java
index 8d08b3d..596a217 100644
--- 
a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryProtocolTest.java
+++ 
b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryProtocolTest.java
@@ -22,7 +22,7 @@ import org.apache.dubbo.common.extension.ExtensionLoader;
 import org.apache.dubbo.registry.NotifyListener;
 import org.apache.dubbo.registry.RegistryFactory;
 import org.apache.dubbo.registry.RegistryService;
-import org.apache.dubbo.registry.integration.RegistryProtocol;
+import org.apache.dubbo.registry.client.RegistryProtocol;
 import org.apache.dubbo.registry.support.AbstractRegistry;
 import org.apache.dubbo.remoting.exchange.ExchangeClient;
 import org.apache.dubbo.rpc.Exporter;
@@ -44,7 +44,7 @@ import org.junit.jupiter.api.Test;
 import java.util.ArrayList;
 import java.util.List;
 
-import static 
org.apache.dubbo.registry.integration.RegistryProtocol.DEFAULT_REGISTER_PROVIDER_KEYS;
+import static 
org.apache.dubbo.registry.client.RegistryProtocol.DEFAULT_REGISTER_PROVIDER_KEYS;
 import static org.apache.dubbo.rpc.cluster.Constants.EXPORT_KEY;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -85,7 +85,7 @@ public class RegistryProtocolTest {
     public void testExportUrlNull() {
         Assertions.assertThrows(IllegalArgumentException.class, () -> {
             RegistryProtocol registryProtocol = getRegistryProtocol();
-//            registryProtocol.setCluster(new FailfastCluster());
+//          registryProtocol.setCluster(new FailfastCluster());
 
             Protocol dubboProtocol = DubboProtocol.getDubboProtocol();
             registryProtocol.setProtocol(dubboProtocol);
diff --git 
a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryStatusCheckerTest.java
 
b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryStatusCheckerTest.java
index 3f7d5c6..d42cfbc 100644
--- 
a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryStatusCheckerTest.java
+++ 
b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryStatusCheckerTest.java
@@ -17,6 +17,7 @@
 package org.apache.dubbo.registry.dubbo;
 
 import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.URLBuilder;
 import org.apache.dubbo.common.extension.ExtensionLoader;
 import org.apache.dubbo.common.status.Status;
 import org.apache.dubbo.registry.RegistryFactory;
@@ -62,8 +63,9 @@ public class RegistryStatusCheckerTest {
         
ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension().getRegistry(registryUrl);
         
ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension().getRegistry(registryUrl2);
         assertEquals(Status.Level.OK, new 
RegistryStatusChecker().check().getLevel());
+
         String message = new RegistryStatusChecker().check().getMessage();
-        Assertions.assertTrue(message.contains(registryUrl.getAddress() + 
"(connected)"));
-        Assertions.assertTrue(message.contains(registryUrl2.getAddress() + 
"(connected)"));
+        
Assertions.assertTrue(message.contains(URLBuilder.from(registryUrl).setPort(0).build().getAddress()
 + "(connected)"));
+        
Assertions.assertTrue(message.contains(URLBuilder.from(registryUrl2).setPort(0).build().getAddress()
 + "(connected)"));
     }
 }
\ No newline at end of file
diff --git 
a/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastServiceDiscovery.java
 
b/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastServiceDiscovery.java
new file mode 100644
index 0000000..234fdcb
--- /dev/null
+++ 
b/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastServiceDiscovery.java
@@ -0,0 +1,72 @@
+/*
+ * 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.registry.multicast;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.registry.client.ServiceDiscovery;
+import org.apache.dubbo.registry.client.ServiceInstance;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * TODO: make multicast protocol support Service Discovery
+ */
+public class MulticastServiceDiscovery implements ServiceDiscovery {
+    private URL registryURL;
+    private ServiceInstance serviceInstance;
+
+    @Override
+    public void initialize(URL registryURL) throws Exception {
+        this.registryURL = registryURL;
+    }
+
+    @Override
+    public void destroy() throws Exception {
+
+    }
+
+    @Override
+    public void register(ServiceInstance serviceInstance) throws 
RuntimeException {
+        this.serviceInstance = serviceInstance;
+    }
+
+    @Override
+    public void update(ServiceInstance serviceInstance) throws 
RuntimeException {
+        this.serviceInstance = serviceInstance;
+    }
+
+    @Override
+    public void unregister(ServiceInstance serviceInstance) throws 
RuntimeException {
+        this.serviceInstance = null;
+    }
+
+    @Override
+    public Set<String> getServices() {
+        return Collections.singleton("Unsupported Operation");
+    }
+
+    @Override
+    public URL getUrl() {
+        return registryURL;
+    }
+
+    @Override
+    public ServiceInstance getLocalInstance() {
+        return serviceInstance;
+    }
+}
diff --git 
a/dubbo-remoting/dubbo-remoting-grizzly/src/test/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyTransporterTest.java
 
b/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastServiceDiscoveryFactory.java
similarity index 50%
copy from 
dubbo-remoting/dubbo-remoting-grizzly/src/test/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyTransporterTest.java
copy to 
dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastServiceDiscoveryFactory.java
index 8244529..7bef1f5 100644
--- 
a/dubbo-remoting/dubbo-remoting-grizzly/src/test/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyTransporterTest.java
+++ 
b/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastServiceDiscoveryFactory.java
@@ -14,28 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.dubbo.remoting.transport.grizzly;
+package org.apache.dubbo.registry.multicast;
 
 import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.utils.NetUtils;
-import org.apache.dubbo.remoting.RemotingServer;
-import org.apache.dubbo.remoting.transport.ChannelHandlerAdapter;
+import org.apache.dubbo.registry.client.ServiceDiscovery;
+import org.apache.dubbo.registry.client.ServiceDiscoveryFactory;
 
-import org.junit.jupiter.api.Test;
-
-import static org.apache.dubbo.remoting.Constants.BIND_PORT_KEY;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public class GrizzlyTransporterTest {
-    @Test
-    public void shouldAbleToBindGrizzly() throws Exception {
-        int port = NetUtils.getAvailablePort();
-        URL url = new URL("http", "localhost", port,
-                new String[]{BIND_PORT_KEY, String.valueOf(port)});
-
-        RemotingServer server = new GrizzlyTransporter().bind(url, new 
ChannelHandlerAdapter());
-
-        assertThat(server.isBound(), is(true));
+public class MulticastServiceDiscoveryFactory implements 
ServiceDiscoveryFactory {
+    @Override
+    public ServiceDiscovery getServiceDiscovery(URL registryURL) {
+        return new MulticastServiceDiscovery();
     }
 }
diff --git 
a/dubbo-registry/dubbo-registry-multicast/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscovery
 
b/dubbo-registry/dubbo-registry-multicast/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscovery
new file mode 100644
index 0000000..091b549
--- /dev/null
+++ 
b/dubbo-registry/dubbo-registry-multicast/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscovery
@@ -0,0 +1 @@
+multicast=org.apache.dubbo.registry.multicast.MulticastServiceDiscovery
\ No newline at end of file
diff --git 
a/dubbo-registry/dubbo-registry-multicast/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscoveryFactory
 
b/dubbo-registry/dubbo-registry-multicast/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscoveryFactory
new file mode 100644
index 0000000..03eb6fa
--- /dev/null
+++ 
b/dubbo-registry/dubbo-registry-multicast/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscoveryFactory
@@ -0,0 +1 @@
+multicast=org.apache.dubbo.registry.multicast.MulticastServiceDiscoveryFactory
\ No newline at end of file
diff --git 
a/dubbo-registry/dubbo-registry-multicast/src/test/java/org/apache/dubbo/registry/multicast/MulticastRegistryTest.java
 
b/dubbo-registry/dubbo-registry-multicast/src/test/java/org/apache/dubbo/registry/multicast/MulticastRegistryTest.java
index 76eece0..f0b9f1e 100644
--- 
a/dubbo-registry/dubbo-registry-multicast/src/test/java/org/apache/dubbo/registry/multicast/MulticastRegistryTest.java
+++ 
b/dubbo-registry/dubbo-registry-multicast/src/test/java/org/apache/dubbo/registry/multicast/MulticastRegistryTest.java
@@ -30,6 +30,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import static 
org.apache.dubbo.common.constants.RegistryConstants.EMPTY_PROTOCOL;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -39,7 +40,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 public class MulticastRegistryTest {
 
     private String service = "org.apache.dubbo.test.injvmServie";
-    private URL registryUrl = URL.valueOf("multicast://239.255.255.255/");
+    private URL registryUrl = URL.valueOf("multicast://239.239.239.239/");
     private URL serviceUrl = URL.valueOf("dubbo://" + NetUtils.getLocalHost() 
+ "/" + service
             + "?methods=test1,test2");
     private URL adminUrl = URL.valueOf("dubbo://" + NetUtils.getLocalHost() + 
"/*");
@@ -79,7 +80,7 @@ public class MulticastRegistryTest {
     @Test
     public void testGetCustomPort() {
         int port = NetUtils.getAvailablePort();
-        URL customPortUrl = URL.valueOf("multicast://239.255.255.255:" + port);
+        URL customPortUrl = URL.valueOf("multicast://239.239.239.239:" + port);
         MulticastRegistry multicastRegistry = new 
MulticastRegistry(customPortUrl);
         assertThat(multicastRegistry.getUrl().getPort(), is(port));
     }
@@ -132,15 +133,20 @@ public class MulticastRegistryTest {
     @Test
     public void testSubscribe() {
         // verify listener
-        registry.subscribe(consumerUrl, new NotifyListener() {
-            @Override
-            public void notify(List<URL> urls) {
-                assertEquals(serviceUrl.toFullString(), 
urls.get(0).toFullString());
+        final URL[] notifyUrl = new URL[1];
+        for (int i = 0; i < 10; i++) {
+            registry.register(serviceUrl);
+            registry.subscribe(consumerUrl, urls -> {
+                notifyUrl[0] = urls.get(0);
 
                 Map<URL, Set<NotifyListener>> subscribed = 
registry.getSubscribed();
                 assertEquals(consumerUrl, 
subscribed.keySet().iterator().next());
+            });
+            if (!EMPTY_PROTOCOL.equalsIgnoreCase(notifyUrl[0].getProtocol())) {
+                break;
             }
-        });
+        }
+        assertEquals(serviceUrl.toFullString(), notifyUrl[0].toFullString());
     }
 
     /**
diff --git a/dubbo-registry/pom.xml b/dubbo-registry/pom.xml
index bc322bd..39c1322 100644
--- a/dubbo-registry/pom.xml
+++ b/dubbo-registry/pom.xml
@@ -14,7 +14,8 @@
   See the License for the specific language governing permissions and
   limitations under the License.
   -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.dubbo</groupId>
@@ -31,8 +32,8 @@
     </properties>
     <modules>
         <module>dubbo-registry-api</module>
-        <!--        <module>dubbo-registry-default</module>-->
-        <!--        <module>dubbo-registry-multicast</module>-->
+        <module>dubbo-registry-default</module>
+        <module>dubbo-registry-multicast</module>
         <module>dubbo-registry-zookeeper</module>
         <module>dubbo-registry-kubernetes</module>
         <module>dubbo-registry-dns</module>
diff --git 
a/dubbo-remoting/dubbo-remoting-grizzly/src/main/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyServer.java
 
b/dubbo-remoting/dubbo-remoting-grizzly/src/main/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyServer.java
index 3860860..624f643 100644
--- 
a/dubbo-remoting/dubbo-remoting-grizzly/src/main/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyServer.java
+++ 
b/dubbo-remoting/dubbo-remoting-grizzly/src/main/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyServer.java
@@ -39,9 +39,9 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
 
 import static 
org.apache.dubbo.common.constants.CommonConstants.DEFAULT_THREADPOOL;
-import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
-import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.DEFAULT_THREADS;
+import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
 
 /**
  * GrizzlyServer
@@ -62,11 +62,11 @@ public class GrizzlyServer extends AbstractServer {
     protected void doOpen() throws Throwable {
         FilterChainBuilder filterChainBuilder = FilterChainBuilder.stateless();
         filterChainBuilder.add(new TransportFilter());
-
         filterChainBuilder.add(new GrizzlyCodecAdapter(getCodec(), getUrl(), 
this));
         filterChainBuilder.add(new GrizzlyHandler(getUrl(), this));
+
         TCPNIOTransportBuilder builder = TCPNIOTransportBuilder.newInstance();
-        ThreadPoolConfig config = builder.getWorkerThreadPoolConfig();
+        ThreadPoolConfig config = ThreadPoolConfig.defaultConfig();
         config.setPoolName(SERVER_THREAD_POOL_NAME).setQueueLimit(-1);
         String threadpool = getUrl().getParameter(THREADPOOL_KEY, 
DEFAULT_THREADPOOL);
         if (DEFAULT_THREADPOOL.equals(threadpool)) {
@@ -80,7 +80,9 @@ public class GrizzlyServer extends AbstractServer {
         } else {
             throw new IllegalArgumentException("Unsupported threadpool type " 
+ threadpool);
         }
-        builder.setKeepAlive(true).setReuseAddress(false)
+        builder.setWorkerThreadPoolConfig(config)
+                .setKeepAlive(true)
+                .setReuseAddress(false)
                 .setIOStrategy(SameThreadIOStrategy.getInstance());
         transport = builder.build();
         transport.setProcessor(filterChainBuilder.build());
diff --git 
a/dubbo-remoting/dubbo-remoting-grizzly/src/test/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyTransporterTest.java
 
b/dubbo-remoting/dubbo-remoting-grizzly/src/test/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyTransporterTest.java
index 8244529..dbd593e 100644
--- 
a/dubbo-remoting/dubbo-remoting-grizzly/src/test/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyTransporterTest.java
+++ 
b/dubbo-remoting/dubbo-remoting-grizzly/src/test/java/org/apache/dubbo/remoting/transport/grizzly/GrizzlyTransporterTest.java
@@ -31,7 +31,7 @@ public class GrizzlyTransporterTest {
     @Test
     public void shouldAbleToBindGrizzly() throws Exception {
         int port = NetUtils.getAvailablePort();
-        URL url = new URL("http", "localhost", port,
+        URL url = new URL("telnet", "localhost", port,
                 new String[]{BIND_PORT_KEY, String.valueOf(port)});
 
         RemotingServer server = new GrizzlyTransporter().bind(url, new 
ChannelHandlerAdapter());
diff --git 
a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java
 
b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java
index 7e88e7c..eda4b60 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java
@@ -20,6 +20,7 @@ package org.apache.dubbo.remoting.exchange.support.header;
 import org.apache.dubbo.common.URL;
 import org.apache.dubbo.common.logger.Logger;
 import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.common.utils.NetUtils;
 import org.apache.dubbo.remoting.Channel;
 import org.apache.dubbo.remoting.Constants;
 import org.apache.dubbo.remoting.RemotingException;
@@ -35,6 +36,7 @@ import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CountDownLatch;
 
 public class HeartbeatHandlerTest {
 
@@ -61,9 +63,13 @@ public class HeartbeatHandlerTest {
 
     @Test
     public void testServerHeartbeat() throws Exception {
-        URL serverURL = 
URL.valueOf("header://localhost:55555?transporter=netty3");
-        serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
-        TestHeartbeatHandler handler = new TestHeartbeatHandler();
+        URL serverURL = URL.valueOf("telnet://localhost:" + 
NetUtils.getAvailablePort(56780))
+                .addParameter(Constants.EXCHANGER_KEY, HeaderExchanger.NAME)
+                .addParameter(Constants.TRANSPORTER_KEY, "netty3")
+                .addParameter(Constants.HEARTBEAT_KEY, 1000);
+        CountDownLatch connect = new CountDownLatch(1);
+        CountDownLatch disconnect = new CountDownLatch(1);
+        TestHeartbeatHandler handler = new TestHeartbeatHandler(connect, 
disconnect);
         server = Exchangers.bind(serverURL, handler);
         System.out.println("Server bind successfully");
 
@@ -75,21 +81,25 @@ public class HeartbeatHandlerTest {
         serverURL = serverURL.addParameter(Constants.RECONNECT_KEY, false);
 
         client = Exchangers.connect(serverURL);
-        Thread.sleep(10000);
+        disconnect.await();
         Assertions.assertTrue(handler.disconnectCount > 0);
         System.out.println("disconnect count " + handler.disconnectCount);
     }
 
     @Test
     public void testHeartbeat() throws Exception {
-        URL serverURL = 
URL.valueOf("header://localhost:55556?transporter=netty3");
-        serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
-        TestHeartbeatHandler handler = new TestHeartbeatHandler();
+        URL serverURL = URL.valueOf("telnet://localhost:" + 
NetUtils.getAvailablePort(56785))
+                .addParameter(Constants.EXCHANGER_KEY, HeaderExchanger.NAME)
+                .addParameter(Constants.TRANSPORTER_KEY, "netty3")
+                .addParameter(Constants.HEARTBEAT_KEY, 1000);
+        CountDownLatch connect = new CountDownLatch(1);
+        CountDownLatch disconnect = new CountDownLatch(1);
+        TestHeartbeatHandler handler = new TestHeartbeatHandler(connect, 
disconnect);
         server = Exchangers.bind(serverURL, handler);
         System.out.println("Server bind successfully");
 
         client = Exchangers.connect(serverURL);
-        Thread.sleep(10000);
+        connect.await();
         System.err.println("++++++++++++++ disconnect count " + 
handler.disconnectCount);
         System.err.println("++++++++++++++ connect count " + 
handler.connectCount);
         Assertions.assertEquals(0, handler.disconnectCount);
@@ -99,15 +109,19 @@ public class HeartbeatHandlerTest {
     @Test
     public void testClientHeartbeat() throws Exception {
         FakeChannelHandlers.setTestingChannelHandlers();
-        URL serverURL = 
URL.valueOf("header://localhost:55557?transporter=netty3");
-        TestHeartbeatHandler handler = new TestHeartbeatHandler();
+        URL serverURL = URL.valueOf("telnet://localhost:" + 
NetUtils.getAvailablePort(56790))
+                .addParameter(Constants.EXCHANGER_KEY, HeaderExchanger.NAME)
+                .addParameter(Constants.TRANSPORTER_KEY, "netty3");
+        CountDownLatch connect = new CountDownLatch(1);
+        CountDownLatch disconnect = new CountDownLatch(1);
+        TestHeartbeatHandler handler = new TestHeartbeatHandler(connect, 
disconnect);
         server = Exchangers.bind(serverURL, handler);
         System.out.println("Server bind successfully");
 
         FakeChannelHandlers.resetChannelHandlers();
         serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
         client = Exchangers.connect(serverURL);
-        Thread.sleep(10000);
+        connect.await();
         Assertions.assertTrue(handler.connectCount > 0);
         System.out.println("connect count " + handler.connectCount);
     }
@@ -116,6 +130,13 @@ public class HeartbeatHandlerTest {
 
         public int disconnectCount = 0;
         public int connectCount = 0;
+        private CountDownLatch connectCountDownLatch;
+        private CountDownLatch disconnectCountDownLatch;
+
+        public TestHeartbeatHandler(CountDownLatch connectCountDownLatch, 
CountDownLatch disconnectCountDownLatch) {
+            this.connectCountDownLatch = connectCountDownLatch;
+            this.disconnectCountDownLatch = disconnectCountDownLatch;
+        }
 
         public CompletableFuture<Object> reply(ExchangeChannel channel, Object 
request) throws RemotingException {
             return CompletableFuture.completedFuture(request);
@@ -124,11 +145,13 @@ public class HeartbeatHandlerTest {
         @Override
         public void connected(Channel channel) throws RemotingException {
             ++connectCount;
+            connectCountDownLatch.countDown();
         }
 
         @Override
         public void disconnected(Channel channel) throws RemotingException {
             ++disconnectCount;
+            disconnectCountDownLatch.countDown();
         }
 
         @Override
diff --git 
a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientReconnectTest.java
 
b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientReconnectTest.java
index 65fa6a0..a75a429 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientReconnectTest.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientReconnectTest.java
@@ -47,7 +47,7 @@ public class ClientReconnectTest {
             Client client = startClient(port, 200);
             Assertions.assertFalse(client.isConnected());
             RemotingServer server = startServer(port);
-            for (int i = 0; i < 100 && !client.isConnected(); i++) {
+            for (int i = 0; i < 1000 && !client.isConnected(); i++) {
                 Thread.sleep(10);
             }
             Assertions.assertTrue(client.isConnected());
@@ -70,7 +70,8 @@ public class ClientReconnectTest {
 
 
     public Client startClient(int port, int heartbeat) throws 
RemotingException {
-        final String url = "exchange://127.0.0.1:" + port + 
"/client.reconnect.test?check=false&client=netty3&" + Constants.HEARTBEAT_KEY + 
"=" + heartbeat;
+        final String url = "exchange://127.0.0.1:" + port + 
"/client.reconnect.test?check=false&client=netty3&" +
+                Constants.HEARTBEAT_KEY + "=" + heartbeat;
         return Exchangers.connect(url);
     }
 
diff --git 
a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ThreadNameTest.java
 
b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ThreadNameTest.java
index 1228fe0..001b56a 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ThreadNameTest.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ThreadNameTest.java
@@ -44,8 +44,8 @@ public class ThreadNameTest {
     @BeforeEach
     public void before() throws Exception {
         int port = NetUtils.getAvailablePort();
-        serverURL = 
URL.valueOf("netty://localhost?side=provider").setPort(port);
-        clientURL = 
URL.valueOf("netty://localhost?side=consumer").setPort(port);
+        serverURL = 
URL.valueOf("telnet://localhost?side=provider").setPort(port);
+        clientURL = 
URL.valueOf("telnet://localhost?side=consumer").setPort(port);
 
         serverHandler = new ThreadNameVerifyHandler(serverRegex, false);
         clientHandler = new ThreadNameVerifyHandler(clientRegex, true);
diff --git 
a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyTransporterTest.java
 
b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyTransporterTest.java
index 74e263e..0b13de1 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyTransporterTest.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyTransporterTest.java
@@ -35,7 +35,7 @@ public class NettyTransporterTest {
     @Test
     public void shouldAbleToBindNetty4() throws Exception {
         int port = NetUtils.getAvailablePort();
-        URL url = new URL("http", "localhost", port,
+        URL url = new URL("telnet", "localhost", port,
                 new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)});
 
         RemotingServer server = new NettyTransporter().bind(url, new 
ChannelHandlerAdapter());
@@ -48,7 +48,7 @@ public class NettyTransporterTest {
         final CountDownLatch lock = new CountDownLatch(1);
 
         int port = NetUtils.getAvailablePort();
-        URL url = new URL("http", "localhost", port,
+        URL url = new URL("telnet", "localhost", port,
                 new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)});
 
         new NettyTransporter().bind(url, new ChannelHandlerAdapter() {
diff --git 
a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ReplierDispatcherTest.java
 
b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ReplierDispatcherTest.java
index 3ed2aca..37940e6 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ReplierDispatcherTest.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ReplierDispatcherTest.java
@@ -24,6 +24,7 @@ import org.apache.dubbo.remoting.exchange.ExchangeChannel;
 import org.apache.dubbo.remoting.exchange.ExchangeServer;
 import org.apache.dubbo.remoting.exchange.Exchangers;
 import org.apache.dubbo.remoting.exchange.support.ReplierDispatcher;
+
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
@@ -31,7 +32,11 @@ import org.junit.jupiter.api.Test;
 
 import java.io.Serializable;
 import java.util.Random;
-import java.util.concurrent.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
 
 import static org.junit.jupiter.api.Assertions.fail;
 
@@ -54,13 +59,13 @@ public class ReplierDispatcherTest {
         ReplierDispatcher dispatcher = new ReplierDispatcher();
         dispatcher.addReplier(RpcMessage.class, new RpcMessageHandler());
         dispatcher.addReplier(Data.class, (channel, msg) -> new 
StringMessage("hello world"));
-        exchangeServer = Exchangers.bind(URL.valueOf("dubbo://localhost:" + 
port), dispatcher);
+        exchangeServer = Exchangers.bind(URL.valueOf("exchange://localhost:" + 
port + "?" + CommonConstants.TIMEOUT_KEY + "=60000"), dispatcher);
     }
 
 
     @Test
     public void testDataPackage() throws Exception {
-        ExchangeChannel client = 
Exchangers.connect(URL.valueOf("dubbo://localhost:" + port));
+        ExchangeChannel client = 
Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?" + 
CommonConstants.TIMEOUT_KEY + "=60000"));
         Random random = new Random();
         for (int i = 5; i < 100; i++) {
             StringBuilder sb = new StringBuilder();
@@ -91,7 +96,7 @@ public class ReplierDispatcherTest {
     }
 
     void clientExchangeInfo(int port) throws Exception {
-        ExchangeChannel client = 
Exchangers.connect(URL.valueOf("dubbo://localhost:" + port + "?" + 
CommonConstants.TIMEOUT_KEY + "=5000"));
+        ExchangeChannel client = 
Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?" + 
CommonConstants.TIMEOUT_KEY + "=5000"));
         clients.put(Thread.currentThread().getName(), client);
         MockResult result = (MockResult) client.request(new 
RpcMessage(DemoService.class.getName(), "plus", new Class<?>[]{int.class, 
int.class}, new Object[]{55, 25})).get();
         Assertions.assertEquals(result.getResult(), 80);
diff --git 
a/dubbo-remoting/dubbo-remoting-p2p/src/test/java/org/apache/dubbo/remoting/p2p/exchange/support/MulticastExchangeNetworkerTest.java
 
b/dubbo-remoting/dubbo-remoting-p2p/src/test/java/org/apache/dubbo/remoting/p2p/exchange/support/MulticastExchangeNetworkerTest.java
index d102c99..5bdc6a2 100644
--- 
a/dubbo-remoting/dubbo-remoting-p2p/src/test/java/org/apache/dubbo/remoting/p2p/exchange/support/MulticastExchangeNetworkerTest.java
+++ 
b/dubbo-remoting/dubbo-remoting-p2p/src/test/java/org/apache/dubbo/remoting/p2p/exchange/support/MulticastExchangeNetworkerTest.java
@@ -16,10 +16,6 @@
  */
 package org.apache.dubbo.remoting.p2p.exchange.support;
 
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-
 import org.apache.dubbo.common.URL;
 import org.apache.dubbo.common.utils.NetUtils;
 import org.apache.dubbo.remoting.Channel;
@@ -30,12 +26,16 @@ import 
org.apache.dubbo.remoting.exchange.support.ExchangeHandlerAdapter;
 import org.apache.dubbo.remoting.p2p.Group;
 import org.apache.dubbo.remoting.p2p.Networkers;
 import org.apache.dubbo.remoting.p2p.Peer;
+
 import org.junit.jupiter.api.Test;
 
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.mockito.Mockito.mock;
 
@@ -48,7 +48,7 @@ public class MulticastExchangeNetworkerTest {
 
         final CountDownLatch countDownLatch = new CountDownLatch(1);
         Peer peer1 = multicastExchangeNetworker.lookup(URL.valueOf(groupURL))
-                .join(URL.valueOf("dubbo://0.0.0.0:" + 
NetUtils.getAvailablePort()), new ExchangeHandlerAdapter() {
+                .join(URL.valueOf("exchange://0.0.0.0:" + 
NetUtils.getAvailablePort() + "?exchanger=header"), new 
ExchangeHandlerAdapter() {
                     @Override
                     public CompletableFuture<Object> reply(ExchangeChannel 
channel, Object msg) throws RemotingException {
                         countDownLatch.countDown();
@@ -56,7 +56,7 @@ public class MulticastExchangeNetworkerTest {
                     }
                 });
         Peer peer2 = multicastExchangeNetworker.lookup(URL.valueOf(groupURL))
-                .join(URL.valueOf("dubbo://0.0.0.0:" + 
NetUtils.getAvailablePort()), mock(ExchangeHandler.class));
+                .join(URL.valueOf("exchange://0.0.0.0:" + 
NetUtils.getAvailablePort() + "?exchanger=header"), 
mock(ExchangeHandler.class));
 
         while (true) {
             for (Channel channel : peer1.getChannels()) {
diff --git 
a/dubbo-remoting/dubbo-remoting-p2p/src/test/java/org/apache/dubbo/remoting/p2p/support/FileNetworkerTest.java
 
b/dubbo-remoting/dubbo-remoting-p2p/src/test/java/org/apache/dubbo/remoting/p2p/support/FileNetworkerTest.java
index a442173..a3f881a 100644
--- 
a/dubbo-remoting/dubbo-remoting-p2p/src/test/java/org/apache/dubbo/remoting/p2p/support/FileNetworkerTest.java
+++ 
b/dubbo-remoting/dubbo-remoting-p2p/src/test/java/org/apache/dubbo/remoting/p2p/support/FileNetworkerTest.java
@@ -55,13 +55,13 @@ public class FileNetworkerTest {
         Group group = networker.lookup(URL.valueOf(groupURL));
 
         final CountDownLatch countDownLatch = new CountDownLatch(1);
-        Peer peer1 = group.join(URL.valueOf("dubbo://0.0.0.0:" + 
NetUtils.getAvailablePort()), new ChannelHandlerAdapter() {
+        Peer peer1 = group.join(URL.valueOf("exchange://0.0.0.0:" + 
NetUtils.getAvailablePort() + "?exchanger=header"), new ChannelHandlerAdapter() 
{
             @Override
             public void received(Channel channel, Object message) {
                 countDownLatch.countDown();
             }
         });
-        Peer peer2 = group.join(URL.valueOf("dubbo://0.0.0.0:" + 
NetUtils.getAvailablePort()),
+        Peer peer2 = group.join(URL.valueOf("exchange://0.0.0.0:" + 
NetUtils.getAvailablePort() + "?exchanger=header"),
                 mock(ChannelHandlerAdapter.class));
 
         while (true) {
diff --git 
a/dubbo-remoting/dubbo-remoting-p2p/src/test/java/org/apache/dubbo/remoting/p2p/support/MulticastNetworkerTest.java
 
b/dubbo-remoting/dubbo-remoting-p2p/src/test/java/org/apache/dubbo/remoting/p2p/support/MulticastNetworkerTest.java
index 2229f04..a7702a5 100644
--- 
a/dubbo-remoting/dubbo-remoting-p2p/src/test/java/org/apache/dubbo/remoting/p2p/support/MulticastNetworkerTest.java
+++ 
b/dubbo-remoting/dubbo-remoting-p2p/src/test/java/org/apache/dubbo/remoting/p2p/support/MulticastNetworkerTest.java
@@ -23,6 +23,7 @@ import org.apache.dubbo.remoting.p2p.Group;
 import org.apache.dubbo.remoting.p2p.Networkers;
 import org.apache.dubbo.remoting.p2p.Peer;
 import org.apache.dubbo.remoting.transport.ChannelHandlerAdapter;
+
 import org.junit.jupiter.api.Test;
 
 import java.util.concurrent.CountDownLatch;
@@ -38,7 +39,7 @@ public class MulticastNetworkerTest {
     @Test
     public void testJoin() throws RemotingException, InterruptedException {
         final String groupURL = "multicast://224.5.6.7:1234";
-        final String peerURL = "dubbo://0.0.0.0:" + 
NetUtils.getAvailablePort();
+        final String peerURL = "exchange://0.0.0.0:" + 
NetUtils.getAvailablePort() + "?exchanger=header";
 
         final CountDownLatch countDownLatch = new CountDownLatch(1);
         Peer peer1 = Networkers.join(groupURL, peerURL, new 
ChannelHandlerAdapter() {
@@ -47,7 +48,7 @@ public class MulticastNetworkerTest {
                 countDownLatch.countDown();
             }
         });
-        Peer peer2 = Networkers.join(groupURL, "dubbo://0.0.0.0:" + 
NetUtils.getAvailablePort(),
+        Peer peer2 = Networkers.join(groupURL, "exchange://0.0.0.0:" + 
NetUtils.getAvailablePort() + "?exchanger=header",
                 mock(ChannelHandlerAdapter.class));
 
         while (true) {
diff --git a/pom.xml b/pom.xml
index e49eed2..5459ea6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -583,6 +583,8 @@
                                 </exclude>
                                 <exclude>.github/**</exclude>
                                 <exclude>compiler/**</exclude>
+                                <!-- exclude mockito extensions spi files -->
+                                <exclude>**/mockito-extensions/*</exclude>
                             </excludes>
                         </configuration>
                     </execution>

Reply via email to