@Test
    public void testOnlyPublish() throws InterruptedException {

        Field registedAppField = null;
        try {
            registedAppField = MeshRegistry.class.getDeclaredField("registedApp");
            registedAppField.setAccessible(true);
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }

        Boolean registedAppValue = null;
        // in case of effected by other case.
        try {
            registedAppValue = (Boolean) registedAppField.get(registry);
            registedAppField.set(registry, false);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        ServerConfig serverConfig = new ServerConfig()
            .setProtocol("bolt")
            .setHost("0.0.0.0")
            .setPort(12200);
        ProviderConfig<?> provider = new ProviderConfig();
        provider.setInterfaceId("com.alipay.xxx.TestService")
            .setUniqueId("unique123Id")
            .setApplication(new ApplicationConfig().setAppName("test-server"))
            .setProxy("javassist")
            .setRegister(true)
            .setRegistry(registryConfig)
            .setSerialization("hessian2")
            .setServer(serverConfig)
            .setWeight(222)
            .setTimeout(3000);

        registry.register(provider);
        Thread.sleep(3000);

        try {
            registedAppValue = (Boolean) registedAppField.get(registry);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        LOGGER.info("final registedAppValue is " + registedAppValue);

        Assert.assertTrue(registedAppValue);
    }
@author <a href="mailto:zhanggeng.zg@antfin.com">GengZhang</a>
registry/registry-mesh/src/test/java/com/alipay/sofa/rpc/registry/mesh/MeshRegistryTest.java