'L{server.DNSServerFactory.buildProtocol} builds a protocol by calling
L{server.DNSServerFactory.protocol} with its self as a positional
argument.'

def test_buildProtocolProtocolOverride(self):

    class FakeProtocol(object, ):
        factory = None
        args = None
        kwargs = None
    stubProtocol = FakeProtocol()
    def fakeProtocolFactory(*args, **kwargs):
        stubProtocol.args = args
        stubProtocol.kwargs = kwargs
        return stubProtocol
    f = server.DNSServerFactory()
    f.protocol = fakeProtocolFactory
    p = f.buildProtocol(addr=None)
    self.assertEqual((stubProtocol, (f,), {}), (p, p.args, p.kwargs))
