'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 runAbortTest(self, clientClass, serverClass, clientConnectionLostReason=None):

    clientExpectedExceptions = (ConnectionAborted, ConnectionLost)
    serverExpectedExceptions = (ConnectionLost, ConnectionDone)
    if useSSL:
        clientExpectedExceptions = (clientExpectedExceptions + (SSL.Error,))
        serverExpectedExceptions = (serverExpectedExceptions + (SSL.Error,))
    client = clientClass()
    server = serverClass()
    client.otherProtocol = server
    server.otherProtocol = client
    reactor = runProtocolsWithReactor(self, server, client, self.endpoints)
    self.assertEqual(reactor.removeAll(), [])
    self.assertEqual(reactor.getDelayedCalls(), [])
    if (clientConnectionLostReason is not None):
        self.assertIsInstance(client.disconnectReason.value, ((clientConnectionLostReason,) + clientExpectedExceptions))
    else:
        self.assertIsInstance(client.disconnectReason.value, clientExpectedExceptions)
    self.assertIsInstance(server.disconnectReason.value, serverExpectedExceptions)
