@Override
    public void prepare() throws ServiceNotProvidedException, ModuleStartException {
        try {
            List<Address> addressList = ConnectUtils.parse(config.getHostPort());

            List<HostAndPort> hostAndPorts = new ArrayList<>();
            for (Address address : addressList) {
                hostAndPorts.add(HostAndPort.fromParts(address.getHost(), address.getPort()));
            }

            Consul.Builder consulBuilder = Consul.builder()
                                                 //                    we should set this value or it will be blocked forever
                                                 .withConnectTimeoutMillis(3000);

            if (StringUtils.isNotEmpty(config.getAclToken())) {
                consulBuilder.withAclToken(config.getAclToken());
            }

            if (hostAndPorts.size() > 1) {
                client = consulBuilder.withMultipleHostAndPort(hostAndPorts, 5000).build();
            } else {
                client = consulBuilder.withHostAndPort(hostAndPorts.get(0)).build();
            }
        } catch (ConnectStringParseException | ConsulException e) {
            throw new ModuleStartException(e.getMessage(), e);
        }
        ConsulCoordinator coordinator = new ConsulCoordinator(getManager(), config, client);
        this.registerServiceImplementation(ClusterRegister.class, coordinator);
        this.registerServiceImplementation(ClusterNodesQuery.class, coordinator);
        this.registerServiceImplementation(ClusterCoordinator.class, coordinator);
    }
@Test
    public void prepareSingle() throws Exception {
        ClusterModuleConsulConfig consulConfig = new ClusterModuleConsulConfig();
        consulConfig.setHostPort("10.0.0.1:1000");
        Whitebox.setInternalState(provider, "config", consulConfig);

        Consul consulClient = mock(Consul.class);
        Consul.Builder builder = mock(Consul.Builder.class);
        when(builder.build()).thenReturn(consulClient);

        try (MockedStatic<Consul> ignored = mockStatic(Consul.class)) {
            when(Consul.builder()).thenReturn(builder);
            when(builder.withConnectTimeoutMillis(anyLong())).thenReturn(builder);

            when(builder.withHostAndPort(any())).thenReturn(builder);

            provider.prepare();

            ArgumentCaptor<HostAndPort> hostAndPortArgumentCaptor = ArgumentCaptor.forClass(HostAndPort.class);
            verify(builder).withHostAndPort(hostAndPortArgumentCaptor.capture());

            HostAndPort address = hostAndPortArgumentCaptor.getValue();
            assertEquals(HostAndPort.fromParts("10.0.0.1", 1000), address);
        }
    }