private void maybeAddSubprotocol(RequestHeaders headers,
                                     ResponseHeadersBuilder responseHeadersBuilder) {
        final String subprotocols = headers.get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, "");
        if (subprotocols.isEmpty()) {
            return;
        }
        commaSplitter.splitToStream(subprotocols)
                     .filter(sub -> SUB_PROTOCOL_WILDCARD.equals(sub) ||
                                    this.subprotocols.contains(sub))
                     .findFirst().ifPresent(selectedSubprotocol -> responseHeadersBuilder.add(
                             HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol));
    }
Handles the HTTP/1.1 web socket handshake described in
<a href="https://datatracker.ietf.org/doc/html/rfc6455">The WebSocket Protocol</a>.
These are examples of a request and its corresponding response:

<p>Request:
<pre>
GET /chat HTTP/1.1
Host: server.example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Origin: http://example.com
Sec-WebSocket-Protocol: chat, superchat
Sec-WebSocket-Version: 13
</pre>

<p>Response:
<pre>
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
Sec-WebSocket-Protocol: chat
</pre>
core/src/main/java/com/linecorp/armeria/internal/server/websocket/DefaultWebSocketService.java