URLDownloader implements Downloader { @Override public int start(Uri uri, long breakpoint) throws IOException { redirectionCount.set(MAX_REDIRECTION); httpURLConnection = innerRequest(uri, breakpoint); return httpURLConnection.getResponseCode(); } private  URLDownloader(); static URLDownloader create(); @Override String detectFilename(Uri uri); @Override int start(Uri uri, long breakpoint); @Override long contentLength(); @Override InputStream byteStream(); @Override void close(); @Override Downloader copy();  }
@Test public void testBadUrl() { try { urlDownloader.start(Uri.parse("www.baidu.com"), 0); } catch (Exception e) { if (e instanceof IllegalArgumentException) { assertEquals("unexpected url: www.baidu.com", e.getMessage()); } } }