class AbortConnectionMixin: (source)
Known subclasses: twisted.internet.test.test_tcp.AbortConnectionTests
, twisted.internet.test.test_tls.AbortSSLConnectionTests
Unit tests for ITransport.abortConnection
.
Method | run |
A test runner utility function, which hooks up a matched pair of client and server protocols. |
Method | test_client |
Client calls abortConnection(), followed by loseConnection(). |
Method | test_client |
abortConnection() is called twice by client. |
Method | test_data |
abortConnection() is called in dataReceived. The protocol should be disconnected, but connectionLost should not be called re-entrantly. |
Method | test_data |
dataReceived calls abortConnection(), and then raises an exception. |
Method | test_full |
abortConnection() triggered by the write buffer being full. |
Method | test_full |
abortConnection() is triggered by a write buffer being full. |
Method | test_resume |
abortConnection() is called in resumeProducing, before any bytes have been exchanged. The protocol should be disconnected, but connectionLost should not be called re-entrantly. |
Method | test_resume |
abortConnection() is called in resumeProducing, after some bytes have been exchanged. The protocol should be disconnected. |
Method | test_resume |
resumeProducing calls abortConnection(), and then raises an exception. |
Method | test_server |
Server calls abortConnection(), followed by loseConnection(). |
Method | test_server |
abortConnection() is called twice by server. |
Class Variable | endpoints |
Undocumented |
A test runner utility function, which hooks up a matched pair of client and server protocols.
We then run the reactor until both sides have disconnected, and then verify that the right exception resulted.
Client calls abortConnection(), followed by loseConnection().
No exception should be thrown, and the connection will be closed.
abortConnection() is called twice by client.
No exception should be thrown, and the connection will be closed.
abortConnection() is called in dataReceived. The protocol should be disconnected, but connectionLost should not be called re-entrantly.
dataReceived calls abortConnection(), and then raises an exception.
The connection will be lost, with the thrown exception (ZeroDivisionError) as the reason on the client. The idea here is that bugs should not be masked by abortConnection, in particular unexpected exceptions.
abortConnection() triggered by the write buffer being full.
In particular, the server side stops reading. This is supposed to simulate a realistic timeout scenario where the client notices the server is no longer accepting data.
The protocol should be disconnected, but connectionLost should not be called re-entrantly.
abortConnection() is triggered by a write buffer being full.
However, this buffer is filled after some bytes have been exchanged, allowing a TLS handshake if we're testing TLS. The connection will then be lost.
def test_resumeProducingAbort(self): (source) ¶
abortConnection() is called in resumeProducing, before any bytes have been exchanged. The protocol should be disconnected, but connectionLost should not be called re-entrantly.
def test_resumeProducingAbortLater(self): (source) ¶
abortConnection() is called in resumeProducing, after some bytes have been exchanged. The protocol should be disconnected.
resumeProducing calls abortConnection(), and then raises an exception.
The connection will be lost, with the thrown exception (ZeroDivisionError) as the reason on the client. The idea here is that bugs should not be masked by abortConnection, in particular unexpected exceptions.
Server calls abortConnection(), followed by loseConnection().
No exception should be thrown, and the connection will be closed.
abortConnection() is called twice by server.
No exception should be thrown, and the connection will be closed.
twisted.internet.test.test_tcp.AbortConnectionTests
, twisted.internet.test.test_tls.AbortSSLConnectionTests
Undocumented