}
}
// Connect to target host:
try {
Socket socket = new Socket(host, port);
MuxStream stream = new MuxStream(false, null, socket);
MuxFetcher fetchers[] = new MuxFetcher[urls.size()];
// Fork the fetchers:
for (int i = 0 ; i < urls.size() ; i++) {
URL u = new URL((String) urls.elementAt(i));
fetchers[i] = new MuxFetcher(stream, u);
}
// Wait for completion:
for (int i = 0 ; i < fetchers.length ; i++) {
fetchers[i].join();
}
// Close mux stream:
stream.shutdown(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}