factory.close();
}
@Test
public void neverReturnInactiveClients() throws IOException, InterruptedException {
TransportClientFactory factory = context.createClientFactory();
TransportClient c1 = factory.createClient(TestUtils.getLocalHost(), server1.getPort());
c1.close();
long start = System.currentTimeMillis();
while (c1.isActive() && (System.currentTimeMillis() - start) < 3000) {
Thread.sleep(10);
}
assertFalse(c1.isActive());
TransportClient c2 = factory.createClient(TestUtils.getLocalHost(), server1.getPort());
assertFalse(c1 == c2);
assertTrue(c2.isActive());
factory.close();
}