diff --git a/tests/Calm.java b/tests/Calm.java new file mode 100644 index 0000000..29793ae --- /dev/null +++ b/tests/Calm.java @@ -0,0 +1,34 @@ + +import network.MessageGenerator; +import network.RequestSender; + +/** + * Simulates an entire lab canceling their request at the same time. + * + * Tests threading and queue overflow. + * + */ +public class Calm { + + public static void main(String[] args) { + + final RequestSender requestSender = new RequestSender("127.0.0.1"); + final MessageGenerator generator = new MessageGenerator(); + + + // using 2 to 30 since those are numbers that all lab layouts have + for (int i = 2; i <= 30; i++) { + + final int x = i; + + new Thread(new Runnable() { + + public void run() { + requestSender.sendRequest(generator.cancelRequest(String.valueOf(x))); + } + }).start(); + + } + + } +}