private WebSocketUpgradeResult upgradeHttp1(ServiceRequestContext ctx, HttpRequest req) throws Exception {
        if (!ctx.sessionProtocol().isExplicitHttp1()) {
            final HttpResponse httpResponse =
                    failOrFallback(ctx, req, () -> HttpResponse.of(HttpStatus.METHOD_NOT_ALLOWED));
            return WebSocketUpgradeResult.ofFailure(httpResponse);
        }
        final RequestHeaders headers = req.headers();
        if (!isHttp1WebSocketUpgradeRequest(headers)) {
            final HttpResponse httpResponse =
                    failOrFallback(ctx, req, () -> HttpResponse.of(
                            HttpStatus.BAD_REQUEST, MediaType.PLAIN_TEXT_UTF_8,
                            "The upgrade header must contain:\n" +
                            "  Upgrade: websocket\n" +
                            "  Connection: Upgrade"));
            return WebSocketUpgradeResult.ofFailure(httpResponse);
        }

        HttpResponse invalidResponse = checkOrigin(ctx, headers);
        if (invalidResponse != null) {
            return WebSocketUpgradeResult.ofFailure(invalidResponse);
        }

        invalidResponse = checkVersion(headers);
        if (invalidResponse != null) {
            return WebSocketUpgradeResult.ofFailure(invalidResponse);
        }

        final String webSocketKey = headers.get(HttpHeaderNames.SEC_WEBSOCKET_KEY, "");
        if (webSocketKey.isEmpty()) {
            return WebSocketUpgradeResult.ofFailure(
                    HttpResponse.of(HttpStatus.BAD_REQUEST, MediaType.PLAIN_TEXT_UTF_8,
                                    "missing Sec-WebSocket-Key header"));
        }
        return WebSocketUpgradeResult.ofSuccess();
    }
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