public static HttpHeaders toArmeria(Http2Headers http2Headers, boolean request, boolean endOfStream) {
        assert http2Headers instanceof ArmeriaHttp2Headers;
        final HttpHeadersBuilder delegate = ((ArmeriaHttp2Headers) http2Headers).delegate();
        delegate.endOfStream(endOfStream);

        maybeSetContentLengthUnknown(delegate.contains(HttpHeaderNames.CONTENT_LENGTH), delegate);

        HttpHeaders headers = delegate.build();

        if (request) {
            if (headers.contains(HttpHeaderNames.METHOD)) {
                headers = RequestHeaders.of(headers);
            }
            // http2Headers should be a trailers
        } else {
            if (headers.contains(HttpHeaderNames.STATUS)) {
                headers = ResponseHeaders.of(headers);
            }
        }
        return headers;
    }
Converts the specified Netty HTTP/2 into Armeria HTTP/2 headers.
core/src/main/java/com/linecorp/armeria/internal/common/ArmeriaHttpUtil.java