private void doTotalOrderTest(int numberOfMembers) throws Exception {
        final int maxMessages = 1024;
        final int totalMessages = maxMessages * numberOfMembers;
        for (int i = 0; i < numberOfMembers; ++i) {
            TOANode node = createNewChannel("to_test_" + i);
            node.start("to_test_cluster_" + numberOfMembers);
            node.setEstimatedMessages(totalMessages);
        }
        for (TOANode member : registeredToaNodes) {
            member.waitAllMembers(registeredToaNodes, 30, TimeUnit.SECONDS);
        }
        final ExecutorService executor = Executors.newFixedThreadPool(numberOfMembers);
        final CyclicBarrier barrier = new CyclicBarrier(numberOfMembers);
        final CountDownLatch shutdown = new CountDownLatch(numberOfMembers);
        for (TOANode node : registeredToaNodes) {
            executor.execute(new TOANodeRunnable(node) {
                @Override
                public void run() {
                    final String address = toaNode.channel.getAddressAsString();
                    try {
                        barrier.await();
                        for (int i = 0; i < maxMessages; ++i) {
                            toaNode.sendTotalOrderAnycastMessage(new AnycastAddress(), "to-message-" + address + "-" + i);
                        }
                        shutdown.countDown();
                    } catch (InterruptedException e) {
                        Thread.currentThread().interrupt();
                    }
                    catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
        }
        shutdown.await();
        executor.shutdown();
        executor.awaitTermination(10, TimeUnit.SECONDS);
        assertTrue(executor.shutdownNow().isEmpty());
        for (TOANode node : registeredToaNodes) {
            node.waitMessages(totalMessages, 30, TimeUnit.SECONDS);
        }
        for (int i = 0; i < totalMessages; ++i) {
            Iterator<TOANode> iterator = registeredToaNodes.iterator();
            String message = iterator.next().pop();
            while (iterator.hasNext()) {
                TOANode node = iterator.next();
                assertEquals("wrong message order #" + i + " for " + node.channel.getAddress(),
                        message, node.pop());
            }
        }
    }