twisted.internet.test.test_endpoints._HostnameEndpointMemoryReactorMixin(ClientEndpointTestCaseMixin)
class documentationtwisted.internet.test.test_endpoints
(View In Hierarchy)
Known subclasses: twisted.internet.test.test_endpoints.HostnameEndpointMemoryIPv4ReactorTests, twisted.internet.test.test_endpoints.HostnameEndpointMemoryIPv6ReactorTests
Common methods for testing HostnameEndpoint
against MemoryReactor
instances that do not provide IReactorPluggableNameResolver
.
Method | synchronousDeferredToThread | A synchronous version of deferToThread . |
Method | expectedClients | Extract expected clients from the reactor. |
Method | connectArgs | |
Method | assertConnectArgs | No summary |
Method | test_endpointConnectFailure | When HostnameEndpoint.connect
cannot connect to its destination, the returned Deferred will
fail with ConnectError . |
Method | test_deprecation | Instantiating HostnameEndpoint
with a reactor that does not provide IReactorPluggableResolver
emits a deprecation warning. |
Method | test_errorsLogged | Hostname resolution errors are logged. |
Inherited from ClientEndpointTestCaseMixin:
Method | test_interface | The endpoint provides interfaces.IStreamClientEndpoint |
Method | retrieveConnectedFactory | Retrieve a single factory that has connected using the given reactor. (This behavior is valid for TCP and SSL but needs to be overridden for UNIX.) |
Method | test_endpointConnectSuccess | A client endpoint can connect and returns a deferred who gets called back with a protocol instance. |
Method | test_endpointConnectingCancelled | Calling Deferred.cancel
on the Deferred
returned from IStreamClientEndpoint.connect
is errbacked with an expected ConnectingCancelledError
exception. |
Method | test_endpointConnectNonDefaultArgs | The endpoint should pass it's connectArgs parameter to the reactor's listen methods. |
A synchronous version of deferToThread
.
Parameters | f | The callable to invoke. (type: callable ) |
args | Positional arguments to the callable. | |
kwargs | Keyword arguments to the callable. | |
Returns | A Deferred
that fires with the result of applying f to args
and kwargs or the exception raised. |
Extract expected clients from the reactor.
Parameters | reactor | The MemoryReactor
under test. |
Returns | List of calls to IReactorTCP.connectTCP |
Compare host, port, timeout, and bindAddress in
receivedArgs
to expectedArgs
. We ignore the
factory because we don't only care what protocol comes out of the
IStreamClientEndpoint.connect
call.
Parameters | receivedArgs | tuple of (host , port ,
factory , timeout , bindAddress ) that
was passed to IReactorTCP.connectTCP . |
expectedArgs | tuple of (host , port ,
factory , timeout , bindAddress ) that
we expect to have been passed to IReactorTCP.connectTCP . |
When HostnameEndpoint.connect
cannot connect to its destination, the returned Deferred
will
fail with ConnectError
.
Instantiating HostnameEndpoint
with a reactor that does not provide IReactorPluggableResolver
emits a deprecation warning.