'Issue an MX request for the given domain and arrange for it to be
responded to with the given records.  Verify that the resulting mail
exchange is the indicated host.
@type domain: C{str}
@type records: C{list} of L{RRHeader}
@type correctMailExchange: C{str}
@rtype: L{Deferred}'

def _exchangeTest(self, domain, records, correctMailExchange):

    class DummyResolver(object, ):
        def lookupMailExchange(self, name):
            if (name == domain):
                return defer.succeed((records, [], []))
            return defer.fail(DNSNameError(domain))
    self.mx.resolver = DummyResolver()
    d = self.mx.getMX(domain)
    def gotMailExchange(record):
        self.assertEqual(str(record.name), correctMailExchange)
    d.addCallback(gotMailExchange)
    return d
