}
public void testClosedConnection() throws Exception {
rc.put("k","v"); //make sure a connection is created
GenericKeyedObjectPool keyedObjectPool = transportFactory.getConnectionPool();
InetSocketAddress address = new InetSocketAddress("127.0.0.1", hotRodServer.getPort());
assertEquals(0, keyedObjectPool.getNumActive(address));
assertEquals(1, keyedObjectPool.getNumIdle(address));
TcpTransport tcpConnection = (TcpTransport) keyedObjectPool.borrowObject(address);
keyedObjectPool.returnObject(address, tcpConnection);//now we have a reference to the single connection in pool
tcpConnection.destroy();
assertEquals("v", rc.get("k"));
assertEquals(0, keyedObjectPool.getNumActive(address));
assertEquals(1, keyedObjectPool.getNumIdle(address));
TcpTransport tcpConnection2 = (TcpTransport) keyedObjectPool.borrowObject(address);
assert tcpConnection2.getId() != tcpConnection.getId();
}