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

Function identityPumpPolicy identityPumpPolicy is a policy which delivers each chunk of data written to the given queue as-is to the target.
Function collapsingPumpPolicy collapsingPumpPolicy is a policy which collapses all outstanding chunks into a single string and delivers it 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.
Class LoopbackRelay Undocumented
Class LoopbackClientFactory Undocumented
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 _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 _LoopbackAddress Undocumented
Class _LoopbackTransport No class docstring; 1/10 methods documented
Function _loopbackAsyncBody Transfer bytes from the output queue of each protocol to the input of the other.
Function _loopbackAsyncContinue Undocumented
Class _FireOnClose Undocumented
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 AlsoloopbackAsync
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 AlsoloopbackAsync
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.

ParametersserverThe 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.
ReturnsA Deferred which fires when the connection has been closed and both sides have received notification of this.
def _loopbackAsyncBody(server, serverToClient, client, clientToServer, pumpPolicy): (source)

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

ParametersserverThe 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.
ReturnsA 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
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.

API Documentation for Twisted, generated by pydoctor at 2018-10-15 19:29:43.