twisted.test.iosim.FakeTransport
class documentationtwisted.test.iosim
(View In Hierarchy)
Known subclasses: twisted.conch.test.test_endpoints.AbortableFakeTransport
Implements interfaces: twisted.internet.interfaces.ITLSTransport, twisted.internet.interfaces.ITransport
A wrapper around a file-like object to make it behave as a Transport.
This doesn't actually stream the file to the attached protocol, and is thus useful mainly as a utility for debugging protocols.
Method | __init__ | |
Method | __repr__ | Undocumented |
Method | write | Write some data to the physical connection, in sequence, in a non-blocking fashion. |
Method | registerProducer | From abstract.FileDescriptor |
Method | unregisterProducer | Undocumented |
Method | stopConsuming | Undocumented |
Method | writeSequence | Write an iterable of byte strings to the physical connection. |
Method | loseConnection | Close my connection, after writing all pending data. |
Method | abortConnection | For the time being, this is the same as loseConnection; no buffered data will be lost. |
Method | reportDisconnect | Undocumented |
Method | logPrefix | Identify this transport/event source to the logging system. |
Method | getPeer | Get the remote address of this connection. |
Method | getHost | Similar to getPeer, but returns an address describing this side of the connection. |
Method | resumeProducing | Undocumented |
Method | pauseProducing | Undocumented |
Method | stopProducing | Undocumented |
Method | startTLS | Initiate TLS negotiation. |
Method | getOutBuffer | Get the pending writes from this transport, clearing them from the pending buffer. |
Method | bufferReceived | Undocumented |
Method | _checkProducer | Undocumented |
Parameters | protocol | This transport will deliver bytes to this protocol. (type: IProtocol
provider) |
isServer | True if this is the accepting side of the connection,
False if it is the connecting side. (type: bool ) | |
hostAddress | The value to return from getHost . None
results in a new FakeAddress
being created to use as the value. (type: IAddress
provider or None ) | |
peerAddress | The value to return from getPeer . None
results in a new FakeAddress
being created to use as the value. (type: IAddress
provider or None ) |
Write some data to the physical connection, in sequence, in a non-blocking fashion.
If possible, make sure that it is all written. No data will ever be lost, although (obviously) the connection may be closed before it all gets through.
Parameters | data | The data to write. (type: bytes ) |
Write an iterable of byte strings to the physical connection.
If possible, make sure that all of the data is written to the socket at once, without first copying it all into a single byte string.
Parameters | data | The data to write. (type: an iterable of bytes ) |
Close my connection, after writing all pending data.
Note that if there is a registered producer on a transport it will not be closed until the producer has been unregistered.
For the time being, this is the same as loseConnection; no buffered data will be lost.
Get the remote address of this connection.
Treat this method with caution. It is the unfortunate result of the CGI and Jabber standards, but should not be considered reliable for the usual host of reasons; port forwarding, proxying, firewalls, IP masquerading, etc.
Returns | An IAddress
provider. |
Similar to getPeer, but returns an address describing this side of the connection.
Returns | An IAddress
provider. |
Initiate TLS negotiation.
Parameters | contextFactory | An object which creates appropriately configured TLS connections.
For clients, use IOpenSSLClientConnectionCreator
or IOpenSSLServerConnectionCreator ,
depending on whether this ITLSTransport
is a server or not. If the appropriate interface is not provided by the
value given for contextFactory , it must be an implementor of
IOpenSSLContextFactory .) |
Get the pending writes from this transport, clearing them from the pending buffer.
Returns | the bytes written with transport.write (type: bytes ) |