private boolean membersReachableOnlyViaPublicAddress(Collection<Member> members) {
        List<Member> shuffledList = new ArrayList<>(members);
        Collections.shuffle(shuffledList);
        Iterator<Member> iter = shuffledList.iterator();
        for (int i = 0; i < REACHABLE_CHECK_NUMBER; i++) {
            if (!iter.hasNext()) {
                iter = shuffledList.iterator();
            }
            Member member = iter.next();
            Address publicAddress = member.getAddressMap().get(CLIENT_PUBLIC_ENDPOINT_QUALIFIER);
            Address internalAddress = member.getAddress();
            if (publicAddress == null) {
                logger.fine("The public address is not available on the member. The client will use internal addresses");
                return false;
            }
            if (isReachable(internalAddress, REACHABLE_ADDRESS_TIMEOUT_MILLIS)) {
                logger.fine("The internal address is reachable. The client will use the internal addresses");
                return false;
            }
            if (!isReachable(publicAddress, NON_REACHABLE_ADDRESS_TIMEOUT_MILLIS)) {
                logger.fine("Public address %s is not reachable. The client will use internal addresses", publicAddress);
                return false;
            }
        }
        logger.fine("Members are accessible via only public addresses. The client will use public addresses");
        return true;
    }
@Test
    public void membersReachableOnlyViaPublicAddress() {
        // given
        Hazelcast.newHazelcastInstance();
        TranslateToPublicAddressProvider translateProvider = createTranslateProvider();

        // when
        translateProvider.init(new InitialMembershipEvent(mock(Cluster.class),
                new HashSet<>(Collections.singletonList(member(UNREACHABLE_HOST, REACHABLE_HOST)))));
        boolean result = translateProvider.getAsBoolean();

        // then
        assertTrue(result);
    }