@Test
    public void testSubscribeWithToken() {

        RegistryConfig registryConfig = new RegistryConfig()
                .setProtocol("consul")
                .setAddress("127.0.0.1:" + consul.getHttpPort())
                .setRegister(true);

        ConsulRegistry registryWithoutToken = (ConsulRegistry) RegistryFactory.getRegistry(registryConfig);
        registryWithoutToken.init();

        ProviderConfig<?> providerConfig = providerConfig("consul-test-1", 12200, 12201, 12202);
        registry.register(providerConfig);

        ConsumerConfig<?> consumerConfig = consumerConfig("consul-test-1");

        assertUntil(() -> {
            List<ProviderGroup> providerGroups = registryWithoutToken.subscribe(consumerConfig);
            Assert.assertEquals(1, providerGroups.size());
            Assert.assertEquals(0, providerGroups.get(0).size());
        }, 10, TimeUnit.SECONDS);

        assertUntil(() -> {
            List<ProviderGroup> providerGroups = registry.subscribe(consumerConfig);
            Assert.assertEquals(1, providerGroups.size());
            Assert.assertEquals(3, providerGroups.get(0).size());
        }, 10, TimeUnit.SECONDS);


        ConsumerConfig<?> consumerConfigWithAnotherUniqueId = consumerConfig("consul-test-2");

        assertUntil(() -> {
            List<ProviderGroup> providerGroups = registryWithoutToken.subscribe(consumerConfigWithAnotherUniqueId);
            Assert.assertEquals(1, providerGroups.size());
            Assert.assertEquals(0, providerGroups.get(0).size());
        }, 10, TimeUnit.SECONDS);

        registryWithoutToken.unSubscribe(consumerConfig);
        registryWithoutToken.unSubscribe(consumerConfigWithAnotherUniqueId);
    }
Consul Registry Acl Tests

@author <a href=mailto:wangyx1122@gmail.com>kunple-w</a>
registry/registry-consul/src/test/java/com/alipay/sofa/rpc/registry/consul/ConsulRegistryAclTest.java