config1.setProperty(GroupProperties.PROP_MERGE_FIRST_RUN_DELAY_SECONDS, "5");
config1.setProperty(GroupProperties.PROP_MERGE_NEXT_RUN_DELAY_SECONDS, "3");
config1.getGroupConfig().setName("differentGroup");
NetworkConfig networkConfig1 = config1.getNetworkConfig();
JoinConfig join1 = networkConfig1.getJoin();
join1.getMulticastConfig().setEnabled(multicast);
join1.getTcpIpConfig().setEnabled(!multicast);
join1.getTcpIpConfig().addMember("127.0.0.1");
Config config2 = new Config();
config2.setProperty(GroupProperties.PROP_MERGE_FIRST_RUN_DELAY_SECONDS, "5");
config2.setProperty(GroupProperties.PROP_MERGE_NEXT_RUN_DELAY_SECONDS, "3");
config2.getGroupConfig().setName("sameGroup");
NetworkConfig networkConfig2 = config2.getNetworkConfig();
JoinConfig join2 = networkConfig2.getJoin();
join2.getMulticastConfig().setEnabled(multicast);
join2.getTcpIpConfig().setEnabled(!multicast);
join2.getTcpIpConfig().addMember("127.0.0.1");
HazelcastInstance h1 = Hazelcast.newHazelcastInstance(config1);
HazelcastInstance h2 = Hazelcast.newHazelcastInstance(config2);
LifecycleCountingListener l = new LifecycleCountingListener();
h2.getLifecycleService().addLifecycleListener(l);