Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. String requestJson = "jsondata";
  2.  
  3. String url = "http://gooddata.com:4055/test?action=search";
  4. for (int i = 1; i <= 100; i++) {
  5. long start = System.currentTimeMillis();
  6. CompletableFuture<HttpResponse> resp =
  7. HttpAsyncClientUtils.getInstance().sendPost(2000, url, proxy, requestJson);
  8. HttpResponse response = null;
  9. try {
  10. response = resp.get();
  11. if (response != null) {
  12.  
  13. }
  14. }catch (Exception ex) {
  15. System.out.println("timeout exception.." + ex.getMessage());
  16. }finally {
  17. if (response != null) {
  18. EntityUtils.consumeQuietly(response.getEntity());
  19. }
  20. }
  21. long end = System.currentTimeMillis();
  22. System.out.println(end - start);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement