Advertisement
kolban

Untitled

Nov 25th, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. package kolban;
  2.  
  3. import org.apache.http.HttpEntity;
  4. import org.apache.http.client.methods.CloseableHttpResponse;
  5. import org.apache.http.client.methods.HttpGet;
  6. import org.apache.http.impl.client.CloseableHttpClient;
  7. import org.apache.http.impl.client.HttpClients;
  8. import org.apache.http.util.EntityUtils;
  9.  
  10. public class TestLoad {
  11.  
  12. public static void main(String[] args) {
  13. // TODO Auto-generated method stub
  14. try {
  15. int count = 0;
  16. while (true) {
  17. CloseableHttpClient httpclient = HttpClients.createDefault();
  18. HttpGet httpGet = new HttpGet("http://192.168.1.99:9080/helloWorld");
  19. CloseableHttpResponse response1 = httpclient.execute(httpGet);
  20. System.out.println(response1.getStatusLine());
  21. HttpEntity entity1 = response1.getEntity();
  22. EntityUtils.consume(entity1);
  23. response1.close();
  24. count++;
  25. //if (count % 1000 == 0) {
  26. System.out.println("Count: " + count);
  27. //}
  28. Thread.sleep(100);
  29. }
  30. } catch (Exception e) {
  31. e.printStackTrace();
  32. }
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement