use of libcore.java.net.customstreamhandler.http.Handler in project j2objc by google.
the class URLStreamHandlerFactoryTest method testFirstUseIsCached.
public void testFirstUseIsCached() throws Exception {
// clear cached protocol handlers if they exist
factoryField.set(null, null);
URL.setURLStreamHandlerFactory(oldFactory);
// creating a connection should use the platform's default stream handler
URLConnection connection1 = new URL("http://android.com/").openConnection();
assertFalse(connection1 instanceof Handler.HandlerURLConnection);
try {
// set the property and get another connection. The property should not be honored
System.setProperty("java.protocol.handler.pkgs", getHandlerPackageName());
URLConnection connection2 = new URL("http://android.com/").openConnection();
assertFalse(connection2 instanceof Handler.HandlerURLConnection);
} finally {
System.clearProperty("java.protocol.handler.pkgs");
}
}
use of libcore.java.net.customstreamhandler.http.Handler in project robovm by robovm.
the class URLStreamHandlerFactoryTest method testFirstUseIsCached.
public void testFirstUseIsCached() throws Exception {
// clear cached protocol handlers if they exist
factoryField.set(null, null);
URL.setURLStreamHandlerFactory(oldFactory);
// creating a connection should use the platform's default stream handler
URLConnection connection1 = new URL("http://android.com/").openConnection();
assertFalse(connection1 instanceof Handler.HandlerURLConnection);
try {
// set the property and get another connection. The property should not be honored
System.setProperty("java.protocol.handler.pkgs", getHandlerPackageName());
URLConnection connection2 = new URL("http://android.com/").openConnection();
assertFalse(connection2 instanceof Handler.HandlerURLConnection);
} finally {
System.clearProperty("java.protocol.handler.pkgs");
}
}
Aggregations