Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
1 Star 0 Fork 0

迷途的指针/JavaWebTester

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (1)
master
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
The license selected for the repository is subject to the license used by the main branch of the repository.
master
Branches (1)
master
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (1)
master
JavaWebTester
/
src
/
main
/
java
/
Test2.java
JavaWebTester
/
src
/
main
/
java
/
Test2.java
Test2.java 1.79 KB
Copy Edit Raw Blame History
迷途的指针 authored 2018年11月26日 10:21 +08:00 . 添加get支持
import com.google.gson.JsonObject;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.util.Date;
import java.util.Scanner;
public class Test2 {
static public void main(String[] args){
//创建连接
//参数:url, 请求方法(目前只支持Post), 等待时间(两次请求间隔), 数据
TestClientPool pool = new TestClientPool("http://192.168.103.178:8080",RequestMethod.GET, 0, null);
//以8线程同时发起请求
pool.init(32);
Scanner scanner = new Scanner(System.in);
System.out.println("准备就绪,输入回车继续");
scanner.nextLine();
long time1 = new Date().getTime();
//开始发起请求
pool.start();
System.out.println(new Date().toString());
System.out.println("运行开始,输入回车停止");
//输入换行后停止
scanner.nextLine();
pool.stop();
long time2 = new Date().getTime();
//输出经过的时间和发出的请求数量
System.out.println(new Date().toString());
System.out.println(String.format("运行结束,共耗时%d ms,发送了%d个请求,平均每秒%.2f个请求",time2-time1,pool.getCount(),(double)pool.getCount()/(double)(time2-time1)*1000.0));
System.out.println(String.format("总请求数量:%d,平均请求响应时间:%.2f ms,失败请求:%d",
Global.totalCount.get(),
(double)Global.totalResTime.get()/(double)Global.totalCount.get(),
Global.totalFail.get()));
}
}
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/PointerY/JavaWebTester.git
git@gitee.com:PointerY/JavaWebTester.git
PointerY
JavaWebTester
JavaWebTester
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /