Program: 49892
Project: 49892
Buggy source:
@Test(timeout=120000L) public void testRestartCluster() throws Exception {
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(new Config());
  final ClientProperties clientProperties=ClientProperties.crateBaseClientProperties(GroupConfig.DEFAULT_GROUP_NAME,GroupConfig.DEFAULT_GROUP_PASSWORD);
  clientProperties.setPropertyValue(ClientPropertyName.INIT_CONNECTION_ATTEMPTS_LIMIT,"String_Node_Str");
  clientProperties.setPropertyValue(ClientPropertyName.RECONNECTION_ATTEMPTS_LIMIT,"String_Node_Str");
  clientProperties.setPropertyValue(ClientPropertyName.RECONNECTION_TIMEOUT,"String_Node_Str");
  HazelcastClient client=newHazelcastClient(clientProperties,h1);
  final IMap<String,String> map=client.getMap("String_Node_Str");
  final List<String> values=new CopyOnWriteArrayList<String>();
  map.addEntryListener(new EntryAdapter<String,String>(){
    @Override public void entryAdded(    EntryEvent<String,String> event){
      values.add(event.getValue());
    }
    @Override public void entryUpdated(    EntryEvent<String,String> event){
      values.add(event.getValue());
    }
  }
,true);
  final BlockingQueue<LifecycleState> states=new LinkedBlockingQueue<LifecycleState>();
  client.getLifecycleService().addLifecycleListener(new LifecycleListener(){
    public void stateChanged(    LifecycleEvent event){
      states.add(event.getState());
    }
  }
);
  map.put("String_Node_Str","String_Node_Str");
  Thread.sleep(50L);
  assertArrayEquals(values.toString(),new String[]{"String_Node_Str"},values.toArray(new String[0]));
  h1.getLifecycleService().shutdown();
  assertEquals(LifecycleState.CLIENT_CONNECTION_LOST,states.poll(500L,TimeUnit.MILLISECONDS));
  Thread.sleep(50L);
  try {
    map.put("String_Node_Str","String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NoMemberAvailableException e) {
  }
  try {
    map.put("String_Node_Str","String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NoMemberAvailableException e) {
  }
  h1=Hazelcast.newHazelcastInstance(new Config());
  assertEquals(LifecycleState.CLIENT_CONNECTION_OPENING,states.poll(500L,TimeUnit.MILLISECONDS));
  assertEquals(LifecycleState.CLIENT_CONNECTION_OPENED,states.poll(30000L,TimeUnit.MILLISECONDS));
  map.put("String_Node_Str","String_Node_Str");
  Thread.sleep(50L);
  assertArrayEquals(values.toString(),new String[]{"String_Node_Str","String_Node_Str"},values.toArray(new String[0]));
}

Fixed version (ground truth):
@Test(timeout=120000L) public void testRestartCluster() throws Exception {
  HazelcastInstance h1=Hazelcast.newHazelcastInstance(new Config());
  final ClientProperties clientProperties=ClientProperties.createBaseClientProperties(GroupConfig.DEFAULT_GROUP_NAME,GroupConfig.DEFAULT_GROUP_PASSWORD);
  clientProperties.setPropertyValue(ClientPropertyName.INIT_CONNECTION_ATTEMPTS_LIMIT,"String_Node_Str");
  clientProperties.setPropertyValue(ClientPropertyName.RECONNECTION_ATTEMPTS_LIMIT,"String_Node_Str");
  clientProperties.setPropertyValue(ClientPropertyName.RECONNECTION_TIMEOUT,"String_Node_Str");
  HazelcastClient client=newHazelcastClient(clientProperties,h1);
  final IMap<String,String> map=client.getMap("String_Node_Str");
  final List<String> values=new CopyOnWriteArrayList<String>();
  map.addEntryListener(new EntryAdapter<String,String>(){
    @Override public void entryAdded(    EntryEvent<String,String> event){
      values.add(event.getValue());
    }
    @Override public void entryUpdated(    EntryEvent<String,String> event){
      values.add(event.getValue());
    }
  }
,true);
  final BlockingQueue<LifecycleState> states=new LinkedBlockingQueue<LifecycleState>();
  client.getLifecycleService().addLifecycleListener(new LifecycleListener(){
    public void stateChanged(    LifecycleEvent event){
      states.add(event.getState());
    }
  }
);
  map.put("String_Node_Str","String_Node_Str");
  Thread.sleep(50L);
  assertArrayEquals(values.toString(),new String[]{"String_Node_Str"},values.toArray(new String[0]));
  h1.getLifecycleService().shutdown();
  assertEquals(LifecycleState.CLIENT_CONNECTION_LOST,states.poll(500L,TimeUnit.MILLISECONDS));
  Thread.sleep(50L);
  try {
    map.put("String_Node_Str","String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NoMemberAvailableException e) {
  }
  try {
    map.put("String_Node_Str","String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NoMemberAvailableException e) {
  }
  h1=Hazelcast.newHazelcastInstance(new Config());
  assertEquals(LifecycleState.CLIENT_CONNECTION_OPENING,states.poll(500L,TimeUnit.MILLISECONDS));
  assertEquals(LifecycleState.CLIENT_CONNECTION_OPENED,states.poll(30000L,TimeUnit.MILLISECONDS));
  map.put("String_Node_Str","String_Node_Str");
  Thread.sleep(50L);
  assertArrayEquals(values.toString(),new String[]{"String_Node_Str","String_Node_Str"},values.toArray(new String[0]));
}