@Test
public void testGetInstances() throws Exception {

    String serviceName = "ConsulTest77Service";
    assertTrue(consulServiceDiscovery.getInstances(serviceName).isEmpty());
    int portA = NetUtils.getAvailablePort();
    int portB = NetUtils.getAvailablePort();
    consulServiceDiscovery.register(new DefaultServiceInstance(valueOf(System.nanoTime()), serviceName, "127.0.0.1", portA));
    consulServiceDiscovery.register(new DefaultServiceInstance(valueOf(System.nanoTime()), serviceName, "127.0.0.1", portB));
    Thread.sleep(5000);
    Assertions.assertFalse(consulServiceDiscovery.getInstances(serviceName).isEmpty());
    List<String> r = convertToIpPort(consulServiceDiscovery.getInstances(serviceName));
    assertTrue(r.contains("127.0.0.1:" + portA));
    assertTrue(r.contains("127.0.0.1:" + portB));
}