// expected
}
}
public void testRegisterUnregister() {
SchemeRegistry schmreg = new SchemeRegistry();
Scheme http = new Scheme
("http", PlainSocketFactory.getSocketFactory(), 80);
Scheme https = new Scheme
("https", SecureSocketFactoryMockup.INSTANCE, 443);
// ("https", SSLSocketFactory.getSocketFactory(), 443);
Scheme myhttp = new Scheme
("http", PlainSocketFactory.getSocketFactory(), 80);
HttpHost host = new HttpHost("www.test.invalid", -1, "http");
HttpHost hosts = new HttpHost("www.test.invalid", -1, "https");
assertNull(schmreg.register(myhttp));
assertNull(schmreg.register(https));
assertSame(myhttp, schmreg.register(http));
assertSame(http, schmreg.getScheme("http"));
assertSame(http, schmreg.getScheme(host));
assertSame(https, schmreg.getScheme("https"));
assertSame(https, schmreg.getScheme(hosts));
schmreg.unregister("http");
schmreg.unregister("https");
assertNull(schmreg.get("http")); // get() does not throw exception
try {
schmreg.getScheme("http"); // getScheme() does throw exception
fail("IllegalStateException should have been thrown");
} catch (IllegalStateException ex) {
// expected
}
}