@Override
    public ChannelFuture doWriteHeaders(int id, int streamId, ResponseHeaders headers, boolean endStream,
                                        boolean isTrailersEmpty, HttpMethod method) {
        if (!isWritable(id)) {
            return newClosedSessionFuture();
        }

        if (webSocketUpgrading && headers.status() == HttpStatus.SWITCHING_PROTOCOLS) {
            webSocketUpgraded = true;
            final HttpResponse res = new DefaultHttpResponse(
                    HttpVersion.HTTP_1_1, HttpResponseStatus.SWITCHING_PROTOCOLS, false);
            // Call toNettyHttp1Server directly not to remove "Connection: Upgrade" header.
            ArmeriaHttpUtil.toNettyHttp1Server(headers, res.headers(), http1HeaderNaming, false);
            return write(id, res, false);
        }

        final HttpResponse converted = convertHeaders(headers, endStream, isTrailersEmpty, method);
        if (headers.status().isInformational()) {
            return write(id, converted, false);
        }

        return writeNonInformationalHeaders(id, converted, endStream, channel().newPromise());
    }
The ID of the last request whose response headers is written.
core/src/main/java/com/linecorp/armeria/server/ServerHttp1ObjectEncoder.java