}
@Test
public void testNotFailureMode_NoStandbyNode_TwoServers() throws Exception {
TCPController memServer1 = new TCPController();
memServer1.setHandler(new MockHandler("response from server1"));
memServer1.setCodecFactory(new TextLineCodecFactory());
memServer1.bind(new InetSocketAddress(4799));
TCPController memServer2 = new TCPController();
memServer2.setHandler(new MockHandler("response from server2"));
memServer2.setCodecFactory(new TextLineCodecFactory());
memServer2.bind(new InetSocketAddress(4798));
XMemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil
.getAddressMap("localhost:4799 localhost:4798"));
MemcachedClient client = builder.build();
client.setEnableHeartBeat(false);
try {
assertEquals("response from server2", client.get("a"));
assertEquals("response from server2", client.get("a"));
memServer2.stop();
Thread.sleep(1000);
assertEquals("response from server1", client.get("a"));
} finally {
memServer1.stop();
memServer2.stop();
client.shutdown();
}
}