private void doSendMessage(O message) {
        if (isCancelled()) {
            // call was already closed by a client or a timeout scheduler
            return;
        }
        final ResponseHeaders responseHeaders = responseHeaders();
        checkState(responseHeaders != null, "sendHeaders has not been called");
        checkState(!isCloseCalled(), "call is closed");

        if (firstResponse == null) {
            // Write the response headers when the first response is received.
            if (!res.tryWrite(responseHeaders)) {
                maybeCancel();
                return;
            }
            firstResponse = message;
        }

        try {
            if (res.tryWrite(toPayload(message))) {
                if (!method.getType().serverSendsOneMessage()) {
                    // Invoke onReady() only when server can send multiple messages.
                    res.whenConsumed().thenRun(() -> {
                        if (!isCloseCalled() && pendingMessagesUpdater.decrementAndGet(this) == 0) {
                            final Executor blockingExecutor = blockingExecutor();
                            if (blockingExecutor != null) {
                                blockingExecutor.execute(this::invokeOnReady);
                            } else {
                                invokeOnReady();
                            }
                        }
                    });
                }
            } else {
                maybeCancel();
            }
        } catch (Throwable e) {
            close(e, true);
        }
    }
Encapsulates the state of a single server call, reading messages from the client, passing to business logic
via {@link ServerCall.Listener}, and writing messages passed back to the response.
grpc/src/main/java/com/linecorp/armeria/server/grpc/StreamingServerCall.java