'C{maxPersistentPerHost} is enforced per C{(scheme, host, port)}:
different keys have different max connections.'

def test_maxPersistentPerHost(self):

    def addProtocol(scheme, host, port):
        p = StubHTTPProtocol()
        p.makeConnection(StringTransport())
        self.pool._putConnection((scheme, host, port), p)
        return p
    persistent = []
    persistent.append(addProtocol('http', 'example.com', 80))
    persistent.append(addProtocol('http', 'example.com', 80))
    addProtocol('https', 'example.com', 443)
    addProtocol('http', 'www2.example.com', 80)
    self.assertEqual(self.pool._connections[('http', 'example.com', 80)], persistent)
    self.assertEqual(len(self.pool._connections[('https', 'example.com', 443)]), 1)
    self.assertEqual(len(self.pool._connections[('http', 'www2.example.com', 80)]), 1)
