rendered paste bodypackage stresstest;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.io.PrintWriter;import java.net.Socket;/** * * @author gharding */public class Main { private static final int THREADS = 1000; public static void main(String[] args) { for (int i = 0; i < THREADS; i++) { new Thread(new Runnable() { public void run() { Socket socket = null; PrintWriter out = null; BufferedReader in = null; try { socket = new Socket("localhost", 8080); out = new PrintWriter(socket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader(socket.getInputStream())); } catch (Exception e){System.out.println(e.getMessage());} out.print("GET /ratesComet HTTP/1.1\nHost: localhost\n\n"); out.flush(); try { String strIn; while ((strIn = in.readLine()) != null) { //System.out.println(strIn); } } catch (IOException ioe) { System.out.println(ioe.getMessage()); } } }).start(); if (i % 50 == 0) System.out.println("Threads started: "+i); } while (true) { if (Thread.activeCount() > 1) break; System.out.println("Active threads: "+Thread.activeCount()); try { Thread.sleep(5000); } catch (Exception e) {} } }}