'Exercise a lot of the SMTP client code.  This is a "shotgun" style unit
test.  It does a lot of things and hopes that something will go really
wrong if it is going to go wrong.  This test should be replaced with a
suite of nicer tests.'

def test_buffer(self):

    transport = StringTransport()
    a = self.serverClass()
    class fooFactory:
        domain = 'foo.com'
    a.factory = fooFactory()
    a.makeConnection(transport)
    for (send, expect, msg, msgexpect) in self.data:
        if send:
            a.dataReceived(send)
        data = transport.value()
        transport.clear()
        if (not re.match(expect, data)):
            raise AssertionError(send, expect, data)
        if (data[:3] == '354'):
            for line in msg.splitlines():
                if (line and (line[0:1] == '.')):
                    line = ('.' + line)
                a.dataReceived((line + '\r\n'))
            a.dataReceived('.\r\n')
            data = transport.value()
            transport.clear()
            (resp, msgdata) = msgexpect
            if (not re.match(resp, data)):
                raise AssertionError(resp, data)
            for recip in msgdata[2]:
                expected = list(msgdata[:])
                expected[2] = [recip]
                self.assertEqual(a.message[(recip,)], tuple(expected))
    a.setTimeout(None)
