try {
Assert.assertEquals(1, pool.getActiveConnectionCount());
Assert.assertEquals(false, pool.isReconnecting());
Assert.assertEquals(0, pool.getIdleConnectionCount());
connection.execute(new TestOperation() {
@Override
public String execute(TestClient client, ConnectionContext context) throws ConnectionException {
throw new TimeoutException("Test");
}
});
Assert.fail();
}
catch (Throwable t) {
}
finally {
pool.returnConnection(connection);
}
Assert.assertEquals(i+1, pool.getErrorsSinceLastSuccess());
Assert.assertEquals(0, pool.getActiveConnectionCount());
Assert.assertEquals(false, pool.isReconnecting());
Assert.assertEquals(0, pool.getIdleConnectionCount());
}
Connection<TestClient> connection = pool.borrowConnection(WAIT_TIMEOUT);
try {
Assert.assertEquals(1, pool.getActiveConnectionCount());
Assert.assertEquals(false, pool.isReconnecting());
Assert.assertEquals(0, pool.getIdleConnectionCount());
connection.execute(new TestOperation() {
@Override
public String execute(TestClient client, ConnectionContext context) throws ConnectionException {
throw new TimeoutException("Test");
}
});