async def METHOD_NAME(
    cls: Type["Transport"],
    stream: Stream,
    upgrade_request: H11Request | None = None,
) -> "Transport":
    ws = WSConnection(ConnectionType.SERVER)
    if upgrade_request:
        # TODO: Typing issue between h11 and wsproto headers
        # (see: https://github.com/python-hyper/wsproto/issues/173)
        ws.initiate_upgrade_connection(
            headers=upgrade_request.headers,  # type: ignore[arg-type]
            path=upgrade_request.target,
        )
    transport = cls(stream, ws)
    # Wait for client to init WebSocket handshake
    event: Union[str, Event] = "Websocket handshake timeout"
    with trio.move_on_after(WEBSOCKET_HANDSHAKE_TIMEOUT):
        event = await transport._next_ws_event()
    if isinstance(event, Request):
        transport.logger.debug("Accepting WebSocket upgrade")
        await transport._net_send(AcceptConnection())
        return transport
    transport.logger.warning("Unexpected event during WebSocket handshake", ws_event=event)
    raise TransportError(f"Unexpected event during WebSocket handshake: {event}")