final List<Throwable> errors = new CopyOnWriteArrayList<Throwable>();
for (int i = 0; i < threads.length; i++) {
threads[i] = new Thread() {
public void run() {
for (int j = 0; j < nbLoops; j++) {
final MultiThreadedHttpConnectionManager mgr = new MultiThreadedHttpConnectionManager();
final HttpClient client = new HttpClient(mgr);
client.getHttpConnectionManager().getParams().setDefaultMaxConnectionsPerHost(100);
client.getHttpConnectionManager().getParams().setMaxTotalConnections(1000);
for (int i = 0; i < nbDownloads; i++) {
try {
checkHtmlPage(client, new URL("http://localhost:" + forwardedPort2 + path));
} catch (Throwable e) {
errors.add(e);
} finally {
latch.countDown();
System.err.println("Remaining: " + latch.getCount());
}
}
mgr.shutdown();
}
}
};
}
for (int i = 0; i < threads.length; i++) {