@Test
    public void testRegisterWithCustomNameWithToken() {
        ProviderConfig<?> providerConfig = providerConfig("consul-test-1", 12200, 12201, 12202);
        providerConfig.setParameter(ConsulConstants.CONSUL_SERVICE_NAME_KEY, CONSUL_SERVICE_NAME);
        registry.register(providerConfig);

        ConsulClient consulClient = new ConsulClient("localhost", consul.getHttpPort());
        HealthServicesRequest request = HealthServicesRequest.newBuilder().setPassing(true).setToken(token).build();
        assertUntil(() -> {
            Response<List<HealthService>> healthServices = consulClient.getHealthServices(CONSUL_SERVICE_NAME, request);
            Assert.assertEquals(3, healthServices.getValue().size());
        }, 10, TimeUnit.SECONDS);

        HealthServicesRequest requestWithoutToken = HealthServicesRequest.newBuilder().setPassing(true).build();
        assertUntil(() -> {
            Response<List<HealthService>> healthServices = consulClient.getHealthServices(CONSUL_SERVICE_NAME, requestWithoutToken);
            Assert.assertEquals(0, healthServices.getValue().size());
        }, 10, TimeUnit.SECONDS);
        registry.unRegister(providerConfig);

        Response<List<HealthService>> healthServicesAfterUnRegister = consulClient.getHealthServices(INTERFACE_ID, request);
        assertUntil(() -> {
            Response<List<HealthService>> healthServices = consulClient.getHealthServices(CONSUL_SERVICE_NAME, request);
            Assert.assertEquals(0, healthServicesAfterUnRegister.getValue().size());
        }, 10, TimeUnit.SECONDS);
    }
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