@Before
    public void setup() {
        consul = ConsulStarterBuilder.consulStarter()
            .withConsulVersion("1.4.0")
            .withToken(token)
            .withCustomConfig("{\n" +
                "          \"acl\": {\n" +
                "            \"enabled\": true,\n" +
                "            \"default_policy\": \"deny\",\n" +
                "            \"down_policy\": \"deny\",\n" +
                "            \"tokens\": {\n" +
                "                \"agent\": \"db4175d7-c4bf-46c2-a071-8d4fd80c30fc2022-02-20\",\n" +
                "                \"master\": \"db4175d7-c4bf-46c2-a071-8d4fd80c30fc2022-02-20\"\n" +
                "            }\n" +
                "        }")
            .build()
            .start();

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

        registry = (ConsulRegistry) RegistryFactory.getRegistry(registryConfig);
        registry.init();
    }
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