### Question:
HttpOriginSecuritySpi { static String asOrigin(URL url) { URI uri = URI.create(url.toString()); if ("jar".equals(uri.getScheme())) { String schemeSpecificPart = uri.getSchemeSpecificPart(); int endAt = schemeSpecificPart.indexOf("!/"); if (endAt != -1) { schemeSpecificPart = schemeSpecificPart.substring(0, endAt); } uri = URI.create(schemeSpecificPart); } if ("file".equals(uri.getScheme())) { return "null"; } String scheme = uri.getScheme(); String host = uri.getHost(); int port = uri.getPort(); return port != -1 ? format("%s: }  static HttpOriginSecuritySpi newInstance(); @IgnoreJRERequirement final HttpURLConnection openConnection(URL url); final Socket createSocket(URL url); static final String getOrigin();  }### Answer:
@Test public void shouldResolveJARBasedURL() throws Exception { URL url = new URL("jar:http: assertEquals("http: }
@Test public void shouldResolveURL() throws Exception { URL url = new URL("http: assertEquals("http: }
@Test public void shouldResolveURLMissingDefaultHttpPort() throws Exception { URL url = new URL("http: assertEquals("http: }
@Test public void shouldResolveURLMissingDefaultHttpsPort() throws Exception { URL url = new URL("https: assertEquals("https: }