Assert.assertNotNull(entry2);
Assert.assertFalse(callback3.isCompleted());
Assert.assertFalse(callback4.isCompleted());
PoolStats totals = pool.getTotalStats();
Assert.assertEquals(0, totals.getAvailable());
Assert.assertEquals(2, totals.getLeased());
Assert.assertEquals(0, totals.getPending());
pool.release(entry1, true);
pool.release(entry2, true);
Mockito.verify(ioreactor, Mockito.times(2)).connect(
Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Mockito.any(SocketAddress.class),
Mockito.any(), Mockito.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect(
Mockito.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
Mockito.any(SocketAddress.class),
Mockito.any(), Mockito.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest3);
pool.requestCompleted(sessionRequest4);
Assert.assertTrue(callback3.isCompleted());
PoolEntry<String> entry3 = callback3.getEntry();
Assert.assertNotNull(entry3);
Assert.assertTrue(callback4.isCompleted());
PoolEntry<String> entry4 = callback4.getEntry();
Assert.assertNotNull(entry4);
totals = pool.getTotalStats();
Assert.assertEquals(0, totals.getAvailable());
Assert.assertEquals(2, totals.getLeased());
Assert.assertEquals(0, totals.getPending());
BasicPoolEntryCallback callback5 = new BasicPoolEntryCallback();
pool.lease("somehost", null, -1, TimeUnit.MILLISECONDS, callback5);
BasicPoolEntryCallback callback6 = new BasicPoolEntryCallback();
pool.lease("otherhost", null, -1, TimeUnit.MILLISECONDS, callback6);
Mockito.verify(ioreactor, Mockito.times(2)).connect(
Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Mockito.any(SocketAddress.class),
Mockito.any(), Mockito.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect(
Mockito.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
Mockito.any(SocketAddress.class),
Mockito.any(), Mockito.any(SessionRequestCallback.class));
pool.release(entry3, true);
pool.release(entry4, true);
Mockito.verify(ioreactor, Mockito.times(3)).connect(
Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Mockito.any(SocketAddress.class),
Mockito.any(), Mockito.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect(
Mockito.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
Mockito.any(SocketAddress.class),
Mockito.any(), Mockito.any(SessionRequestCallback.class));
pool.requestCompleted(sessionRequest1);
Assert.assertTrue(callback5.isCompleted());
PoolEntry<String> entry5 = callback5.getEntry();
Assert.assertNotNull(entry5);
Assert.assertTrue(callback6.isCompleted());
PoolEntry<String> entry6 = callback6.getEntry();
Assert.assertNotNull(entry6);
totals = pool.getTotalStats();
Assert.assertEquals(0, totals.getAvailable());
Assert.assertEquals(2, totals.getLeased());
Assert.assertEquals(0, totals.getPending());
pool.release(entry5, true);
pool.release(entry6, true);
Mockito.verify(ioreactor, Mockito.times(3)).connect(
Mockito.eq(InetSocketAddress.createUnresolved("somehost", 80)),
Mockito.any(SocketAddress.class),
Mockito.any(), Mockito.any(SessionRequestCallback.class));
Mockito.verify(ioreactor, Mockito.times(2)).connect(
Mockito.eq(InetSocketAddress.createUnresolved("otherhost", 80)),
Mockito.any(SocketAddress.class),
Mockito.any(), Mockito.any(SessionRequestCallback.class));
totals = pool.getTotalStats();
Assert.assertEquals(2, totals.getAvailable());
Assert.assertEquals(0, totals.getLeased());
Assert.assertEquals(0, totals.getPending());
}