twisted.protocols.loopback
module documentationtwisted.protocols
View Source
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 |
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 |
collapsingPumpPolicy
is a policy which collapses all outstanding chunks into a single string and
delivers it to the target.
See Also | 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.
Parameters | server | The protocol instance representing the server-side of this connection. |
client | The protocol instance representing the client-side of this connection. | |
pumpPolicy | When 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. |
Transfer bytes from the output queue of each protocol to the input of the other.
Parameters | server | The protocol instance representing the server-side of this connection. |
serverToClient | The _LoopbackQueue
holding the server's output. | |
client | The protocol instance representing the client-side of this connection. | |
clientToServer | The _LoopbackQueue
holding the client's output. | |
pumpPolicy | See loopbackAsync . | |
Returns | A Deferred
which fires when the connection has been closed and both sides have
received notification of this. |
Run session between server and client protocol instances over TCP.
Run session between server and client protocol instances over UNIX socket.