'Exception L{CannotListenError} raised by C{listenUDP} should be turned
into a C{Failure} passed to errback of the C{Deferred} returned by
L{DNSDatagramProtocol.query}.'

def test_listenError(self):

    def startListeningError():
        raise CannotListenError(None, None, None)
    self.proto.startListening = startListeningError
    self.proto.transport = None
    d = self.proto.query(('127.0.0.1', 21345), [dns.Query('foo')])
    return self.assertFailure(d, CannotListenError)
