'Write a sequence of L{bytes} to a L{DatagramProtocol}.'

def test_writeSequence(self):

    class SimpleDatagramProtocol(DatagramProtocol, ):
        def __init__(self):
            self.defer = Deferred()
        def datagramReceived(self, data, addr):
            self.defer.callback(data)
    reactor = self.buildReactor()
    protocol = SimpleDatagramProtocol()
    defer = protocol.defer
    port = self.getListeningPort(reactor, protocol)
    address = port.getHost()
    dataToWrite = ('some', 'bytes', 'to', 'write')
    def gotData(data):
        self.assertEqual(''.join(dataToWrite), data)
    defer.addCallback(gotData)
    defer.addErrback(err)
    defer.addCallback((lambda ignored: reactor.stop()))
    port.writeSequence(dataToWrite, ('127.0.0.1', address.port))
    self.runReactor(reactor)
