Click the csdn traffic code and click the csdn traffic code.
Thread
import java.io.IOException;import java.net.HttpURLConnection;import java.net.InetSocketAddress;import java.net.Proxy;import java.net.SocketAddress;import java.net.URL;public class VisitThread extends Thread { private String url; public VisitThread(String url) { this.url = url; } public void run() { for (int i = 1; i <= 10000; i++) { try { visit(url); } catch (IOException e) { e.printStackTrace(); } } } private static Proxy proxy; static { SocketAddress sa = new InetSocketAddress("223.19.196.232", 80); proxy=new Proxy(java.net.Proxy.Type.HTTP, sa); } public void visit(String url) throws IOException { HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(proxy); connection.setRequestProperty("User-Agent", ""); connection.getInputStream(); connection.disconnect(); }}
Main
public class Main { public static void main(String[] args) { for (int k = 0; k < 400; k++) {new VisitThread("http://blog.csdn.net/fuck_csdn_fuck/article/details/48153119").start();} }}
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.