@Override
    public Promise<PooledConnection> acquire(
            EventLoop eventLoop, CurrentPassport passport, AtomicReference<? super InetAddress> selectedHostAddr) {

        if (draining) {
            throw new IllegalStateException("Attempt to acquire connection while draining");
        }

        requestConnCounter.increment();
        updateServerStatsOnAcquire();

        Promise<PooledConnection> promise = eventLoop.newPromise();

        // Try getting a connection from the pool.
        final PooledConnection conn = tryGettingFromConnectionPool(eventLoop);
        if (conn != null) {
            // There was a pooled connection available, so use this one.
            reusePooledConnection(passport, selectedHostAddr, conn, promise);
        } else {
            // connection pool empty, create new connection using client connection factory.
            tryMakingNewConnection(eventLoop, promise, passport, selectedHostAddr);
        }

        return promise;
    }
@Test
    void acquireNewConnection() throws InterruptedException, ExecutionException {
        CurrentPassport currentPassport = CurrentPassport.create();
        Promise<PooledConnection> promise = pool.acquire(CLIENT_EVENT_LOOP, currentPassport, new AtomicReference<>());

        PooledConnection connection = promise.sync().get();
        assertEquals(1, requestConnCounter.count());
        assertEquals(1, createNewConnCounter.count());
        assertNotNull(currentPassport.findState(PassportState.ORIGIN_CH_CONNECTING));
        assertNotNull(currentPassport.findState(PassportState.ORIGIN_CH_CONNECTED));
        assertEquals(1, createConnSucceededCounter.count());
        assertEquals(1, connsInUse.get());

        // check state on PooledConnection - not all thread safe
        CLIENT_EVENT_LOOP
                .submit(() -> {
                    checkChannelState(connection, currentPassport, 1);
                })
                .sync();
    }