final String key = "name";
memcachedClient.set(key, 0, "dennis");
assertEquals("dennis", memcachedClient.get(key));
CountDownLatch latch = new CountDownLatch(1);
int currentServerCount = memcachedClient.getAvaliableServers().size();
MockErrorCommand errorCommand = null;
if (memcachedClient.getProtocol() == Protocol.Text) {
errorCommand = new MockErrorTextGetOneCommand(key, key.getBytes(),
CommandType.GET_ONE, latch);
} else {
errorCommand = new MockErrorBinaryGetOneCommand(key,
key.getBytes(), CommandType.GET_ONE, latch, OpCode.GET,
false);
}
memcachedClient.getConnector().send((Command) errorCommand);
latch.await(MemcachedClient.DEFAULT_OP_TIMEOUT, TimeUnit.MILLISECONDS);
assertTrue(errorCommand.isDecoded());
// wait for reconnecting
Thread.sleep(2000 * 3);
assertEquals(currentServerCount, memcachedClient.getAvaliableServers()
.size());
// It works