HttpDownloader extends Downloader { public static boolean isSwapUrl(Uri uri) { return isSwapUrl(uri.getHost(), uri.getPort()); } HttpDownloader(Uri uri, File destFile);   HttpDownloader(Uri uri, File destFile, String username, String password); @Override void download(); static boolean isSwapUrl(Uri uri); static boolean isSwapUrl(URL url); static boolean isSwapUrl(String host, int port); @Override @TargetApi(24) long totalDownloadSize(); @Override boolean hasChanged(); @Override void close(); static final String HEADER_FIELD_ETAG; static String queryString; }
@Test public void testIsSwapUri() throws MalformedURLException { FDroidApp.subnetInfo = new SubnetUtils("192.168.0.112/24").getInfo(); String urlString = "http: assertTrue(HttpDownloader.isSwapUrl("192.168.0.112", 8888)); assertTrue(HttpDownloader.isSwapUrl(Uri.parse(urlString))); assertTrue(HttpDownloader.isSwapUrl(new URL(urlString))); assertFalse(HttpDownloader.isSwapUrl("192.168.1.112", 8888)); assertFalse(HttpDownloader.isSwapUrl("192.168.0.112", 80)); assertFalse(HttpDownloader.isSwapUrl(Uri.parse("https: assertFalse(HttpDownloader.isSwapUrl(new URL("https: }