@Test
public void testGetKeyWithSchemeRegistry() throws Exception {
final SchemePortResolver schemePortResolver = Mockito.mock(SchemePortResolver.class);
final BasicAuthCache cache = new BasicAuthCache(schemePortResolver);
Mockito.when(schemePortResolver.resolve(new HttpHost("localhost", -1, "https"))).thenReturn(443);
final HttpHost target = new HttpHost("localhost", 443, "https");
Assert.assertSame(target, cache.getKey(target));
Assert.assertEquals(target, cache.getKey(new HttpHost("localhost", -1, "https")));
}