'Writing to an IPv6 UDP socket on the loopback interface succeeds.'

@skipWithoutIPv6
def test_writeToIPv6Interface(self):

    reactor = self.buildReactor()
    server = Server()
    serverStarted = server.startedDeferred = defer.Deferred()
    self.getListeningPort(reactor, server, interface='::1')
    client = GoodClient()
    clientStarted = client.startedDeferred = defer.Deferred()
    self.getListeningPort(reactor, client, interface='::1')
    cAddr = client.transport.getHost()
    def cbClientStarted(ignored):
        "\n                                                Send    a    datagram    from    the    client    once    it's    started.\n\n                                                @param    ignored:    a    list    of    C{[None,    None]},    which    is    ignored\n                                                @returns:    a    deferred    which    fires    when    the    server    has    received    a\n                                                                datagram.\n                                                "
        client.transport.write('spam', ('::1', server.transport.getHost().port))
        serverReceived = server.packetReceived = defer.Deferred()
        return serverReceived
    def cbServerReceived(ignored):
        '\n                                                Stop    the    reactor    after    a    datagram    is    received.\n\n                                                @param    ignored:    L{None},    which    is    ignored\n                                                @returns:    L{None}\n                                                '
        reactor.stop()
    d = defer.gatherResults([serverStarted, clientStarted])
    d.addCallback(cbClientStarted)
    d.addCallback(cbServerReceived)
    d.addErrback(err)
    self.runReactor(reactor)
    packet = server.packets[0]
    self.assertEqual(packet, ('spam', (cAddr.host, cAddr.port)))
