|
10 | 10 | from contextlib import contextmanager |
11 | 11 | from functools import wraps |
12 | 12 |
|
13 | | -from twisted.test.proto_helpers import MemoryReactor |
| 13 | +from twisted.test.proto_helpers import MemoryReactorClock |
14 | 14 | from twisted.test import iosim |
15 | 15 |
|
16 | 16 | from twisted.internet.address import IPv4Address |
@@ -43,7 +43,7 @@ class _EndpointFactory(object): |
43 | 43 | An endpoint factory used by :class:`RequestTraversalAgent`. |
44 | 44 |
|
45 | 45 | :ivar reactor: The agent's reactor. |
46 | | - :type reactor: :class:`MemoryReactor` |
| 46 | + :type reactor: :class:`MemoryReactorClock` |
47 | 47 | """ |
48 | 48 |
|
49 | 49 | reactor = attr.ib() |
@@ -84,7 +84,7 @@ def __init__(self, rootResource): |
84 | 84 | :param rootResource: The Twisted `IResource` at the root of the |
85 | 85 | resource tree. |
86 | 86 | """ |
87 | | - self._memoryReactor = MemoryReactor() |
| 87 | + self._memoryReactor = MemoryReactorClock() |
88 | 88 | self._realAgent = Agent.usingEndpointFactory( |
89 | 89 | reactor=self._memoryReactor, |
90 | 90 | endpointFactory=_EndpointFactory(self._memoryReactor)) |
@@ -130,7 +130,8 @@ def check_already_called(r): |
130 | 130 | # Create the protocol and fake transport for the client and server, |
131 | 131 | # using the factory that was passed to the MemoryReactor for the |
132 | 132 | # client, and a Site around our rootResource for the server. |
133 | | - serverProtocol = Site(self._rootResource).buildProtocol(None) |
| 133 | + serverFactory = Site(self._rootResource, reactor=self._memoryReactor) |
| 134 | + serverProtocol = serverFactory.buildProtocol(clientAddress) |
134 | 135 | serverTransport = iosim.FakeTransport( |
135 | 136 | serverProtocol, isServer=True, |
136 | 137 | hostAddress=serverAddress, peerAddress=clientAddress) |
|
0 commit comments