@Test
  public void clientsConsume_withNodeShutdown() throws InterruptedException {

    final int initial = 2000, max = 8000;

    for (int i = 0; i < initial; i++) {
      cluster.getRandomNode().getQueue("Q1").offer(i);
      cluster.getRandomNode().getQueue("Q2").offer(i);
    }

    int expectCount = 0;
    for (int i = initial; i < max; i++) {

      if (i == max / 2) {
        cluster.shutdownRandomNode();
      }
      final int index = i;

      assertExactlyOneSuccessfulRun(
          new AssertTask() {
            @Override
            public void run() throws Exception {
              assertTrue(cluster.getRandomNode().getQueue("Q1").offer(index));
            }
          });

      assertExactlyOneSuccessfulRun(
          new AssertTask() {
            @Override
            public void run() throws Exception {
              assertTrue(cluster.getRandomNode().getQueue("Q2").offer(index));
            }
          });

      final int expected = expectCount;

      assertExactlyOneSuccessfulRun(
          new AssertTask() {
            @Override
            public void run() throws Exception {
              assertEquals(expected, client1.getQueue("Q1").poll());
            }
          });

      assertExactlyOneSuccessfulRun(
          new AssertTask() {
            @Override
            public void run() throws Exception {
              assertEquals(expected, client2.getQueue("Q2").poll());
            }
          });

      expectCount++;
    }

    for (int i = expectCount; i < max; i++) {
      assertEquals(i, client1.getQueue("Q1").poll());
      assertEquals(i, client2.getQueue("Q2").poll());
    }
  }
  @Before
  public void init() {
    cluster = new SimpleClusterUtil("A", 3);
    cluster.initCluster();

    ClientConfig clientConfig = new ClientConfig();
    clientConfig.setGroupConfig(new GroupConfig(cluster.getName()));
    client1 = HazelcastClient.newHazelcastClient(clientConfig);
    client2 = HazelcastClient.newHazelcastClient(clientConfig);
  }