コード例 #1
0
  public void testDownload() throws IOException, InstantiationException {
    final SelectorThread st = newThread();
    try {
      st.setAdapter(new StaticResourcesAdapter(tmp.getAbsolutePath()));
      st.listen();
      File file = File.createTempFile("downloaded-largeFile", ".jar", tmp);
      file.deleteOnExit();
      download(String.format("http://localhost:%s/%s", PORT, base.getName()), file);

      Assert.assertEquals("Files should be same size", base.length(), file.length());
    } finally {
      SelectorThreadUtils.stopSelectorThread(st);
    }
  }