Known subclasses: twisted.internet.test.test_tcp.AbortConnectionTests, twisted.internet.test.test_tls.AbortSSLConnectionTests

Unit tests for ITransport.abortConnection.

Method runAbortTest A test runner utility function, which hooks up a matched pair of client and server protocols.
Method test_dataReceivedAbort abortConnection() is called in dataReceived. The protocol should be disconnected, but connectionLost should not be called re-entrantly.
Method test_clientAbortsConnectionTwice abortConnection() is called twice by client.
Method test_clientAbortsConnectionThenLosesConnection Client calls abortConnection(), followed by loseConnection().
Method test_serverAbortsConnectionTwice abortConnection() is called twice by server.
Method test_serverAbortsConnectionThenLosesConnection Server calls abortConnection(), followed by loseConnection().
Method test_resumeProducingAbort 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_resumeProducingAbortLater abortConnection() is called in resumeProducing, after some bytes have been exchanged. The protocol should be disconnected.
Method test_fullWriteBuffer abortConnection() triggered by the write buffer being full.
Method test_fullWriteBufferAfterByteExchange abortConnection() is triggered by a write buffer being full.
Method test_dataReceivedThrows dataReceived calls abortConnection(), and then raises an exception.
Method test_resumeProducingThrows resumeProducing calls abortConnection(), and then raises an exception.
def runAbortTest(self, clientClass, serverClass, clientConnectionLostReason=None):

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.

def test_dataReceivedAbort(self):

abortConnection() is called in dataReceived. The protocol should be disconnected, but connectionLost should not be called re-entrantly.

def test_clientAbortsConnectionTwice(self):

abortConnection() is called twice by client.

No exception should be thrown, and the connection will be closed.

def test_clientAbortsConnectionThenLosesConnection(self):

Client calls abortConnection(), followed by loseConnection().

No exception should be thrown, and the connection will be closed.

def test_serverAbortsConnectionTwice(self):

abortConnection() is called twice by server.

No exception should be thrown, and the connection will be closed.

def test_serverAbortsConnectionThenLosesConnection(self):

Server calls abortConnection(), followed by loseConnection().

No exception should be thrown, and the connection will be closed.

def test_resumeProducingAbort(self):

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):

abortConnection() is called in resumeProducing, after some bytes have been exchanged. The protocol should be disconnected.

def test_fullWriteBuffer(self):

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.

def test_fullWriteBufferAfterByteExchange(self):

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_dataReceivedThrows(self):

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.

def test_resumeProducingThrows(self):

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.

API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.