@@ -0,0 +1,3448 @@
+/*%0ACopyright (c) 2014, Colorado State University%0AAll rights reserved.%0A%0ARedistribution and use in source and binary forms, with or without modification,%0Aare permitted provided that the following conditions are met:%0A%0A1. Redistributions of source code must retain the above copyright notice, this%0A   list of conditions and the following disclaimer.%0A2. Redistributions in binary form must reproduce the above copyright notice,%0A   this list of conditions and the following disclaimer in the documentation%0A   and/or other materials provided with the distribution.%0A%0AThis software is provided by the copyright holders and contributors %22as is%22 and%0Aany express or implied warranties, including, but not limited to, the implied%0Awarranties of merchantability and fitness for a particular purpose are%0Adisclaimed. In no event shall the copyright holder or contributors be liable for%0Aany direct, indirect, incidental, special, exemplary, or consequential damages%0A(including, but not limited to, procurement of substitute goods or services;%0Aloss of use, data, or profits; or business interruption) however caused and on%0Aany theory of liability, whether in contract, strict liability, or tort%0A(including negligence or otherwise) arising in any way out of the use of this%0Asoftware, even if advised of the possibility of such damage.%0A*/%0A%0Apackage galileo.test.net;%0A%0Aimport java.net.Socket;%0A%0Aimport galileo.net.GalileoMessage;%0Aimport galileo.net.NetworkDestination;%0Aimport galileo.serialization.Serializer;%0Aimport galileo.util.PerformanceTimer;%0A%0Apublic class BlockingScaleTestClient implements Runnable %7B%0A%0A    private static boolean verbose = false;%0A%0A    private PerformanceTimer pt = new PerformanceTimer(%22response%22);%0A    private Socket socket;%0A%0A    public BlockingScaleTestClient(NetworkDestination netDest) throws Exception %7B%0A        socket = new Socket(netDest.getHostname(), netDest.getPort());%0A    %7D%0A%0A    @Override%0A    public void run() %7B%0A        try %7B%0A            while (true) %7B%0A                byte%5B%5D payload = new byte%5BScaleTestServer.QUERY_SIZE%5D;%0A                GalileoMessage msg = new GalileoMessage(payload);%0A                byte%5B%5D data = Serializer.serialize(msg);%0A                if (verbose) %7B%0A                    pt.start();%0A                %7D%0A                socket.getOutputStream().write(data);%0A                byte%5B%5D reply = new byte%5BScaleTestServer.REPLY_SIZE%5D;%0A                socket.getInputStream().read(reply);%0A                if (verbose) %7B%0A                    pt.stopAndPrint();%0A                %7D%0A                Thread.sleep(1000);%0A            %7D%0A        %7D catch (Exception e) %7B%0A            e.printStackTrace();%0A            return;%0A        %7D%0A    %7D%0A%0A%0A    public static void main(String%5B%5D args) throws Exception %7B%0A        if (args.length %3C 2) %7B%0A            System.out.println(%22galileo.test.net.ScaleTestClient %22%0A                    + %22host num-threads%22);%0A            System.out.println(%22Add a 3rd parameter to turn on verbose mode.%22);%0A            return;%0A        %7D%0A%0A        String hostname = args%5B0%5D;%0A        int threads = Integer.parseInt(args%5B1%5D);%0A        if (args.length %3E= 3) %7B%0A            BlockingScaleTestClient.verbose = true;%0A        %7D%0A%0A        for (int i = 0; i %3C threads; ++i) %7B%0A            NetworkDestination netDest = new NetworkDestination(%0A                    hostname, ScaleTestServer.PORT);%0A%0A            BlockingScaleTestClient stc = new BlockingScaleTestClient(netDest);%0A            new Thread(stc).start();%0A        %7D%0A    %7D%0A%7D%0A

Add blocking scale test harness