final boolean tryInitialize() {
        final HttpSession session = HttpSession.get(ch);
        id = session.incrementAndGetNumRequestsSent();
        if (id >= MAX_NUM_REQUESTS_SENT || !session.canSendRequest()) {
            final ClosedSessionException exception;
            if (id >= MAX_NUM_REQUESTS_SENT) {
                exception = new ClosedSessionException(
                        "Can't send requests more than " + MAX_NUM_REQUESTS_SENT +
                        " in one connection. ID: " + id);
            } else {
                exception = new ClosedSessionException(
                        "Can't send requests. ID: " + id + ", session active: " +
                        session.isAcquirable(responseDecoder.keepAliveHandler()));
            }
            session.markUnacquirable();
            // No need to send RST because we didn't send any packet and this will be disconnected anyway.
            fail(UnprocessedRequestException.of(exception));
            return false;
        }

        this.session = session;
        responseWrapper = responseDecoder.addResponse(this, id, originalRes, ctx, ch.eventLoop());

        if (timeoutMillis > 0) {
            // The timer would be executed if the first message has not been sent out within the timeout.
            timeoutFuture = ch.eventLoop().schedule(
                    () -> failAndReset(WriteTimeoutException.get()),
                    timeoutMillis, TimeUnit.MILLISECONDS);
        }
        final CancellationScheduler scheduler = cancellationScheduler();
        if (scheduler != null) {
            scheduler.updateTask(newCancellationTask());
            if (ctx.responseTimeoutMode() == ResponseTimeoutMode.CONNECTION_ACQUIRED) {
                scheduler.start();
            }
        }
        if (ctx.isCancelled()) {
            // The previous cancellation task wraps the cause with an UnprocessedRequestException
            // so we return early
            return false;
        }
        return true;
    }
Invoked on each write of an {@link HttpObject}.
core/src/main/java/com/linecorp/armeria/client/AbstractHttpRequestHandler.java