Utilities and helpers for simulating a network
Class | TLSNegotiation | Undocumented |
Class | FakeAddress | The default address type for the host and peer of FakeTransport
connections. |
Class | FakeTransport | A wrapper around a file-like object to make it behave as a Transport. |
Function | makeFakeClient | Create and return a new in-memory transport hooked up to the given protocol. |
Function | makeFakeServer | Create and return a new in-memory transport hooked up to the given protocol. |
Class | IOPump | Utility to pump data between clients and servers for protocol testing. |
Function | connect | Create a new IOPump connecting
two protocols. |
Function | connectedServerAndClient | Connect a given server and client class to each other. |
Class | ConnectionCompleter | A ConnectionCompleter
can cause synthetic TCP connections established by MemoryReactor.connectTCP
and MemoryReactor.listenTCP
to succeed or fail. |
Function | connectableEndpoint | Create an endpoint that can be fired on demand. |
Function | _factoriesShouldConnect | Should the client and server described by the arguments be connected to each other, i.e. do their port numbers match? |
Create and return a new in-memory transport hooked up to the given protocol.
Parameters | clientProtocol | The client protocol to use. (type: IProtocol
provider) |
Returns | The transport. (type: FakeTransport ) |
Create and return a new in-memory transport hooked up to the given protocol.
Parameters | serverProtocol | The server protocol to use. (type: IProtocol
provider) |
Returns | The transport. (type: FakeTransport ) |
Create a new IOPump
connecting
two protocols.
Parameters | serverProtocol | The protocol to use on the accepting side of the connection. (type: IProtocol
provider) |
serverTransport | The transport to associate with serverProtocol . (type: FakeTransport ) | |
clientProtocol | The protocol to use on the initiating side of the connection. (type: IProtocol
provider) | |
clientTransport | The transport to associate with clientProtocol . (type: FakeTransport ) | |
debug | A flag indicating whether to log information about what the IOPump is doing. (type: bool ) | |
greet | Should the IOPump
be flushed
once before returning to put the protocols into their post-handshake or
post-server-greeting state? (type: bool ) | |
Returns | An IOPump which
connects serverProtocol and clientProtocol and
delivers bytes between them when it is pumped. (type: IOPump ) |
Connect a given server and client class to each other.
Parameters | ServerClass | a callable that produces the server-side protocol. (type: 0-argument callable returning IProtocol
provider.) |
ClientClass | like ServerClass but for the other side of the connection. (type: 0-argument callable returning IProtocol
provider.) | |
clientTransportFactory | a callable that produces the transport which will be attached to the
protocol returned from ClientClass . (type: callable taking (IProtocol )
and returning FakeTransport ) | |
serverTransportFactory | a callable that produces the transport which will be attached to the
protocol returned from ServerClass . (type: callable taking (IProtocol )
and returning FakeTransport ) | |
debug | Should this dump an escaped version of all traffic on this connection to
stdout for inspection? (type: bool ) | |
greet | Should the IOPump
be flushed
once before returning to put the protocols into their post-handshake or
post-server-greeting state? (type: bool ) | |
Returns | the client protocol, the server protocol, and an IOPump which, when
its pump and flush methods are called, will move
data between the created client and server protocol instances. (type: 3-tuple
of IProtocol ,
IProtocol ,
IOPump ) |
Should the client and server described by the arguments be connected to each other, i.e. do their port numbers match?
Parameters | clientInfo | the args for connectTCP (type: tuple ) |
serverInfo | the args for listenTCP (type: tuple ) | |
Returns | If they do match, return factories for the client and server that should
connect; otherwise return None ,
indicating they shouldn't be connected. (type: None
or 2-tuple
of (ClientFactory ,
IProtocolFactory )) |
Create an endpoint that can be fired on demand.
Parameters | debug | A flag; whether to dump output from the established connection to stdout. (type: bool ) |
Returns | A client endpoint, and an object that will cause one of the Deferred s
returned by that client endpoint. (type: 2-tuple
of (IStreamClientEndpoint ,
ConnectionCompleter )) |