'The timeout is not allowed to expire after the server has accepted a
DATA command and the client is actively sending data to it.'

def test_resetTimeoutWhileSending(self):

    class SlowFile:
        '\n                                                A    file-like    which    returns    one    byte    from    each    read    call    until    the\n                                                specified    number    of    bytes    have    been    returned.\n                                                '
        def __init__(self, size):
            self._size = size
        def read(self, max=None):
            if self._size:
                self._size -= 1
                return 'x'
            return ''
    failed = []
    onDone = defer.Deferred()
    onDone.addErrback(failed.append)
    clientFactory = smtp.SMTPSenderFactory('source@address', 'recipient@address', SlowFile(1), onDone, retries=0, timeout=3)
    clientFactory.domain = 'example.org'
    clock = task.Clock()
    client = clientFactory.buildProtocol(address.IPv4Address('TCP', 'example.net', 25))
    client.callLater = clock.callLater
    transport = StringTransport()
    client.makeConnection(transport)
    client.dataReceived('220    Ok\r\n250    Ok\r\n250    Ok\r\n250    Ok\r\n354    Ok\r\n')
    self.assertNotIdentical(transport.producer, None)
    self.assertFalse(transport.streaming)
    clock.advance(2)
    self.assertEqual(failed, [])
    transport.producer.resumeProducing()
    clock.advance(2)
    self.assertEqual(failed, [])
    transport.producer.resumeProducing()
    client.dataReceived('250    Ok\r\n')
    self.assertEqual(failed, [])
    self.assertEqual(transport.value(), 'HELO    example.org\r\nMAIL    FROM:<source@address>\r\nRCPT    TO:<recipient@address>\r\nDATA\r\nx\r\n.\r\nRSET\r\n')
