OkHttpDownloader implements Downloader { @Override public int start(Uri uri, long breakpoint) throws IOException { redirectionCount.set(MAX_REDIRECTION); response = innerRequest(client, uri, breakpoint); return response.code(); } private  OkHttpDownloader(OkHttpClient client); static OkHttpDownloader create(); static OkHttpDownloader create(OkHttpClient client); @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 { okHttpDownloader.start(Uri.parse("www.baidu.com"), 0); } catch (Exception e) { if (e instanceof IllegalArgumentException) { assertEquals("unexpected url: www.baidu.com", e.getMessage()); } } }