HTTP抓包测试
Posted FrankChia
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HTTP抓包测试相关的知识,希望对你有一定的参考价值。
package testHTTP;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
public class GetHTTP extends Thread{
public static void main(String[] args) {
new GetHTTP().start();
}
@Override
public void run(){
URL url;
URLConnection conn;
InputStream is;
try {
url = new URL("http://www.baidu.com");
conn = url.openConnection();
is = conn.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
StringBuilder builder = new StringBuilder();
while((line=br.readLine())!=null){
builder.append(line);
}
br.close();
isr.close();
is.close();
System.out.println(builder.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
}
以上是关于HTTP抓包测试的主要内容,如果未能解决你的问题,请参考以下文章
HTTP抓包之接口自动化测试:Fiddler如何抓包?3W字长文教你搞定!