memcachedClient.getConnector().send(errorCommand);
// Force write thread to encode command
errorCommand.setIoBuffer(null);
// wait 100 milliseconds,the operation will be timeout
if (!latch.await(100, TimeUnit.MILLISECONDS)) {
errorCommand.cancel();
}
Thread.sleep(1000);
// It is not written to channel,because it is canceled.
assertEquals(writeMessageCount, memcachedClient.getConnector()
.getStatistics().getWriteMessageCount());