@Test
public void changeAddresses() throws IOException, NamingException {

    final CacheConfiguration conf = new CacheConfiguration();
    conf.setConsistentHashing(false);
    AddressProvider addrsProvider = new DefaultAddressProvider("127.0.0.1:11211");
    factory.setConfiguration(conf);
    factory.setAddressProvider(addrsProvider);
    Cache cache = factory.createCache();
    List<InetSocketAddress> newAddrs = Arrays.asList(new InetSocketAddress("127.0.0.2", 11221));
    factory.changeAddresses(newAddrs);
    Collection<SocketAddress> c = cache.getAvailableServers();
    assertEquals(1, c.size());
    assertEquals(newAddrs, c);
    verify(cacheClientFactory).create(addrsProvider.getAddresses(), conf);
}