private MemcachedClient createMemcachedClient( final String memcachedNodes, final InetSocketAddress address) throws IOException, InterruptedException { final MemcachedNodesManager nodesManager = MemcachedNodesManager.createFor(memcachedNodes, null, _memcachedClientCallback); final ConnectionFactory cf = nodesManager.isEncodeNodeIdInSessionId() ? new SuffixLocatorConnectionFactory( nodesManager, nodesManager.getSessionIdFormat(), Statistics.create(), 1000, 1000) : new DefaultConnectionFactory(); final MemcachedClient result = new MemcachedClient(cf, Arrays.asList(address)); // Wait a little bit, so that the memcached client can connect and is ready when test starts Thread.sleep(100); return result; }