我想並行打n次網址。我搜索了它,發現this的網址。我試圖根據我的需求進行更改(點擊一次url並查看每個響應),但不成功。我在以上鍊接中添加了以下代碼,用於在Task類構造函數中獲取響應並獲取響應,但是此只能在網上工作。平行打n次網址
DefaultHttpClient client = new DefaultHttpClient();
HttpPost method = new HttpPost(aURL);
try {
HttpResponse httpResponse=client.execute(method);
StringBuffer buffer = new StringBuffer();
BufferedReader reader = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent()));
String dataLine = null;
while((dataLine = reader.readLine()) != null){
buffer.append(dataLine);
}
String responseMsg = buffer.toString();
System.out.println(responseMsg);
任何幫助appriciated。
試圖複製DoS? – Ankit 2013-04-05 11:08:46
你的用例是什麼? – rajesh 2013-04-05 11:09:45
也許http://jmeter.apache.org/可以幫助你。 – Krab 2013-04-05 11:09:59