module documentation

Various helpers for tests for connection-oriented transports.

Class BrokenContextFactory A context factory with a broken getContext method, for exercising the error handling for such a case.
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 ConnectableProtocol A protocol to be used with runProtocolsWithReactor.
Class ConnectionTestsMixin This mixin defines test methods which should apply to most ITransport implementations.
Class EndpointCreator Create client and server endpoints that know how to connect to each other.
Class LogObserverMixin Mixin for TestCase subclasses which want to observe log events.
Class Stop A client factory which stops a reactor when a connection attempt fails.
Class StreamClientTestsMixin This mixin defines tests applicable to SOCK_STREAM client implementations.
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.
Function runProtocolsWithReactor Connect two protocols using endpoints and a new reactor instance.
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.
Class _SingleProtocolFactory Factory to be used by runProtocolsWithReactor.
Function _getWriters Like IReactorFDSet.getWriters, but with support for IOCP reactor as well.
def findFreePort(interface='127.0.0.1', family=socket.AF_INET, type=socket.SOCK_STREAM):

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:strThe local address to try to bind the port on.
familyUndocumented
typeThe socket type which will use the resulting port.
Returns
A two-tuple of address and port, like that returned by socket.getsockname.
def runProtocolsWithReactor(reactorBuilder, serverProtocol, clientProtocol, endpointCreator):

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
reactorBuilderA ReactorBuilder instance.
serverProtocolA ConnectableProtocol that will be the server.
clientProtocolA ConnectableProtocol that will be the client.
endpointCreatorAn instance of EndpointCreator.
Returns
The reactor run by this test.
def _getWriters(reactor):

Like IReactorFDSet.getWriters, but with support for IOCP reactor as well.