'Errors while writing cause the protocols to be disconnected.'

def test_errorWriting(self):

    (tlsClient, tlsServer, handshakeDeferred, disconnectDeferred) = self.handshakeProtocols()
    reason = []
    tlsClient.wrappedProtocol.connectionLost = reason.append
    class Wrapper(object, ):
        def __init__(self, wrapped):
            self._wrapped = wrapped
        def __getattr__(self, attr):
            return getattr(self._wrapped, attr)
        def send(self, *args):
            raise Error('ONO!')
    tlsClient._tlsConnection = Wrapper(tlsClient._tlsConnection)
    def handshakeDone(ign):
        tlsClient.write('hello')
    handshakeDeferred.addCallback(handshakeDone)
    def disconnected(ign):
        self.assertTrue(reason[0].check(Error), reason[0])
    disconnectDeferred.addCallback(disconnected)
    return disconnectDeferred
