'L{client.Resolver._connectedProtocol} returns a new
L{DNSDatagramProtocol} connected to a new address with a
cryptographically secure random port number.'

def test_connectedProtocol(self):

    resolver = client.Resolver(servers=[('example.com', 53)])
    firstProto = resolver._connectedProtocol()
    secondProto = resolver._connectedProtocol()
    self.assertIsNotNone(firstProto.transport)
    self.assertIsNotNone(secondProto.transport)
    self.assertNotEqual(firstProto.transport.getHost().port, secondProto.transport.getHost().port)
    return defer.gatherResults([defer.maybeDeferred(firstProto.transport.stopListening), defer.maybeDeferred(secondProto.transport.stopListening)])
