module documentation

Testing support for protocols -- loopback between client and server.

Class LoopbackClientFactory Undocumented
Class LoopbackRelay Undocumented
Function collapsingPumpPolicy collapsingPumpPolicy is a policy which collapses all outstanding chunks into a single string and delivers it to the target.
Function identityPumpPolicy identityPumpPolicy is a policy which delivers each chunk of data written to the given queue as-is to the target.
Function loopbackAsync Establish a connection between server and client then transfer data between them until the connection is closed. This is often useful for testing a protocol.
Function loopbackTCP Run session between server and client protocol instances over TCP.
Function loopbackUNIX Run session between server and client protocol instances over UNIX socket.
Class _FireOnClose Undocumented
Class _LoopbackAddress Undocumented
Class _LoopbackQueue Trivial wrapper around a list to give it an interface like a queue, which the addition of also sending notifications by way of a Deferred whenever the list has something added to it.
Class _LoopbackTransport No class docstring; 0/3 instance variable, 0/1 class variable, 1/10 method documented
Function _loopbackAsyncBody Transfer bytes from the output queue of each protocol to the input of the other.
Function _loopbackAsyncContinue Undocumented
def collapsingPumpPolicy(queue, target): (source)

collapsingPumpPolicy is a policy which collapses all outstanding chunks into a single string and delivers it to the target.

See Also
loopbackAsync
def identityPumpPolicy(queue, target): (source)

identityPumpPolicy is a policy which delivers each chunk of data written to the given queue as-is to the target.

This isn't a particularly realistic policy.

See Also
loopbackAsync
def loopbackAsync(server, client, pumpPolicy=identityPumpPolicy): (source)

Establish a connection between server and client then transfer data between them until the connection is closed. This is often useful for testing a protocol.

Parameters
serverThe protocol instance representing the server-side of this connection.
clientThe protocol instance representing the client-side of this connection.
pumpPolicyWhen either server or client writes to its transport, the string passed in is added to a queue of data for the other protocol. Eventually, pumpPolicy will be called with one such queue and the corresponding protocol object. The pump policy callable is responsible for emptying the queue and passing the strings it contains to the given protocol's dataReceived method. The signature of pumpPolicy is (queue, protocol). queue is an object with a get method which will return the next string written to the transport, or None if the transport has been disconnected, and which evaluates to True if and only if there are more items to be retrieved via get.
Returns
A Deferred which fires when the connection has been closed and both sides have received notification of this.
def loopbackTCP(server, client, port=0, noisy=True): (source)

Run session between server and client protocol instances over TCP.

def loopbackUNIX(server, client, noisy=True): (source)

Run session between server and client protocol instances over UNIX socket.

def _loopbackAsyncBody(server, serverToClient, client, clientToServer, pumpPolicy): (source)

Transfer bytes from the output queue of each protocol to the input of the other.

Parameters
serverThe protocol instance representing the server-side of this connection.
serverToClientThe _LoopbackQueue holding the server's output.
clientThe protocol instance representing the client-side of this connection.
clientToServerThe _LoopbackQueue holding the client's output.
pumpPolicySee loopbackAsync.
Returns
A Deferred which fires when the connection has been closed and both sides have received notification of this.
def _loopbackAsyncContinue(ignored, server, serverToClient, client, clientToServer, pumpPolicy): (source)

Undocumented