Various helpers for tests for connection-oriented transports.
Function | findFreePort | Ask the platform to allocate a free port on the specified interface, then release the socket and return the address which was allocated. |
Class | ConnectableProtocol | A protocol to be used with runProtocolsWithReactor . |
Class | EndpointCreator | Create client and server endpoints that know how to connect to each other. |
Function | runProtocolsWithReactor | Connect two protocols using endpoints and a new reactor instance. |
Class | Stop | A client factory which stops a reactor when a connection attempt fails. |
Class | ClosingLaterProtocol | ClosingLaterProtocol exchanges one byte with its peer and then disconnects itself. This is mostly a work-around for the fact that connectionMade is called before the SSL handshake has completed. |
Class | ConnectionTestsMixin | This mixin defines test methods which should apply to most ITransport
implementations. |
Class | LogObserverMixin | Mixin for TestCase
subclasses which want to observe log events. |
Class | BrokenContextFactory | A context factory with a broken getContext method, for
exercising the error handling for such a case. |
Class | StreamClientTestsMixin | This mixin defines tests applicable to SOCK_STREAM client implementations. |
Class | _SingleProtocolFactory | Factory to be used by runProtocolsWithReactor . |
Function | _getWriters | Like IReactorFDSet.getWriters ,
but with support for IOCP reactor as well. |
Class | _AcceptOneClient | This factory fires a Deferred with
a protocol instance shortly after it is constructed (hopefully long enough
afterwards so that it has been connected to a transport). |
Class | _SimplePullProducer | A pull producer which writes one byte whenever it is resumed. For use
by test_unregisterProducerAfterDisconnect . |
Ask the platform to allocate a free port on the specified interface, then release the socket and return the address which was allocated.
Parameters | interface | The local address to try to bind the port on. (type: str ) |
type | The socket type which will use the resulting port. | |
Returns | A two-tuple of address and port, like that returned by socket.getsockname . |
Connect two protocols using endpoints and a new reactor instance.
A new reactor will be created and run, with the client and server protocol instances connected to each other using the given endpoint creator. The protocols should run through some set of tests, then disconnect; when both have disconnected the reactor will be stopped and the function will return.
Parameters | reactorBuilder | A ReactorBuilder
instance. |
serverProtocol | A ConnectableProtocol
that will be the server. | |
clientProtocol | A ConnectableProtocol
that will be the client. | |
endpointCreator | An instance of EndpointCreator . | |
Returns | The reactor run by this test. |