Use current Starlette, HTTPX and Trio APIs in tests.

--- tests/test_manager.py.orig
+++ tests/test_manager.py
@@ -14,6 +14,14 @@
 
 from . import concurrency
 from .compat import ExceptionGroup
+
+
+def raises(exception, concurrency):
+    if concurrency == "trio":
+        return pytest.RaisesGroup(
+            exception, allow_unwrapped=True, flatten_subgroups=True
+        )
+    return pytest.raises(exception)
 
 
 class StartupFailed(Exception):
@@ -59,7 +67,17 @@
 
         on_shutdown.append(shutdown)
 
-    router = Router(on_startup=on_startup, on_shutdown=on_shutdown)
+    @contextlib.asynccontextmanager
+    async def lifespan(app):
+        for handler in on_startup:
+            await handler()
+        try:
+            yield
+        finally:
+            for handler in on_shutdown:
+                await handler()
+
+    router = Router(lifespan=lifespan)
 
     # Set up spying on exchanged ASGI events.
 
@@ -83,7 +101,7 @@
     with contextlib.ExitStack() as stack:
         # Set up expected raised exceptions.
         if startup_exception is not None:
-            stack.enter_context(pytest.raises(startup_exception))
+            stack.enter_context(raises(startup_exception, concurrency))
         elif body_exception is not None:
             if shutdown_exception is not None:
                 # Trio now raises the new `ExceptionGroup` in case
@@ -94,9 +112,9 @@
                     )
                 )
             else:
-                stack.enter_context(pytest.raises(body_exception))
+                stack.enter_context(raises(body_exception, concurrency))
         elif shutdown_exception is not None:
-            stack.enter_context(pytest.raises(shutdown_exception))
+            stack.enter_context(raises(shutdown_exception, concurrency))
 
         async with LifespanManager(app):
             # NOTE: this block should not execute in case of startup exception.
@@ -159,8 +177,8 @@
 
 @pytest.mark.usefixtures("concurrency")
 @pytest.mark.parametrize("app", [slow_startup, slow_shutdown])
-async def test_lifespan_timeout(app: typing.Callable) -> None:
-    with pytest.raises(TimeoutError):
+async def test_lifespan_timeout(app: typing.Callable, concurrency: str) -> None:
+    with raises(TimeoutError, concurrency):
         async with LifespanManager(app, startup_timeout=0.01, shutdown_timeout=0.01):
             pass
 
@@ -215,13 +233,12 @@
             http_no_assert_before_receive_request,
             marks=pytest.mark.xfail(
                 reason="No way for us to detect unsupported lifespan in this case.",
-                raises=AssertionError,
             ),
         ),
     ],
 )
-async def test_lifespan_not_supported(app: typing.Callable) -> None:
-    with pytest.raises(LifespanNotSupported):
+async def test_lifespan_not_supported(app: typing.Callable, concurrency: str) -> None:
+    with raises(LifespanNotSupported, concurrency):
         async with LifespanManager(app):
             pass  # pragma: no cover
 
@@ -241,7 +258,7 @@
 
     async with LifespanManager(app) as manager:
         async with httpx.AsyncClient(
-            app=manager.app, base_url="http://example.org"
+            transport=httpx.ASGITransport(app=manager.app), base_url="http://example.org"
         ) as client:
             response = await client.get("/get")
             assert response.status_code == 200
