@Test
    public void testMultipleJobsWithMultipleClientsWithDataRequests() {
        System.out.println("multipleJobsWithMultipleClientsWithDataRequests");

        final Random rnd = new Random();

        final Counter totalCounter = new Counter();
        final Counter requestCounter = new Counter();
        final Set<AssignmentListener> computingClients = new HashSet<AssignmentListener>();

        final String dataTitle = "dataId";
        final double requestMultiplier = 2;

        s.assignDataStorage(new DataStorage() {
            @Override
            public Object requestData(Object dataId) {
                if (dataId.equals(dataTitle)) {
                    requestCounter.add(1);
                    return requestMultiplier;
                } else {
                    return null;
                }
            }
        });

        final AssignmentListener l = new AssignmentListener() {

            @Override
            public void receiveTask(Assignment task) {
                try {
                    Object tsk = task.getTask();

                    if (!(tsk instanceof Integer)) {
                        fail("Illegal task received");
                    }

                    Object req = task.requestData(dataTitle);
                    if (req instanceof Double) {
                        double multiplier = (Double) req;

                        int count = (int) (((Integer) tsk) * multiplier);

                        synchronized (task) {
                            task.wait(count);
                        }

                        totalCounter.add(count);
                    } else {
                        fail("Illegal data from server data request - " + req);
                    }

                    System.out.println("Job done - " + tsk);

                    task.submitResult(GenericResponses.OK);
                } catch (ConnectionException ex) {
                    fail("Connection to servr failed - " + ex);
                } catch (InterruptedException ex) {
                    fail("Waiting has been interrupted - " + ex);
                }
            }

            @Override
            public void cancelTask(Assignment task) {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            }
        };
        c.setAssignmentListener(new AssignmentListenerWrapper(computingClients, l));

        final int clientCount = rnd.nextInt(5) + 2;
        Client cl;
        for (int i = 0; i < clientCount - 1; i++) {
            try {
                cl = ClientImpl.initNewClient();
                cl.registerToServer(GlobalConstants.IP_LOOPBACK);
                cl.setAssignmentListener(new AssignmentListenerWrapper(computingClients, l));
                clients.add(cl);
            } catch (Exception ex) {
                fail("Initialization of one of the clients failed - " + ex);
            }
        }

        int cnt = 0, val;
        final int jobCount = clientCount * (rnd.nextInt(3) + 2);
        System.out.println(jobCount);
        Set<Job> allJobs = new HashSet<Job>(jobCount);
        for (int i = 0; i < jobCount; i++) {
            val = (rnd.nextInt(4) + 1) * 10;
            cnt += val;
            allJobs.add(s.submitJob(val));
        }

        s.getJobManager().waitForAllJobs();

        // check all result if OK
        for (Job j : allJobs) {
            System.out.println("Checking job - " + j + " : " + j.getId());
            assertEquals(GenericResponses.OK, j.getResult(true));
            System.out.println("Job checked - " + j + " : " + j.getId());
        }

        assertEquals(cnt * requestMultiplier, totalCounter.getCount(), 0);

        assertEquals(clientCount, computingClients.size());

        assertEquals(jobCount, requestCounter.getCount());
    }