public synchronized void shutdown() {
        if (!isAlive.compareAndSet(true, false)) {
            return;
        }
        executor.shutdownNow();
        ClientExecutionServiceImpl.awaitExecutorTermination("cluster", executor, logger);
        for (ClientConnection connection : activeConnections.values()) {
            connection.close("Hazelcast client is shutting down", null);
        }

        stopNetworking();
        connectionListeners.clear();
        clusterDiscoveryService.current().destroy();
    }
@Test
    public void testSkipMemberListDuringReconnection() {
        HazelcastInstance instance = factory.newHazelcastInstance(smallInstanceConfigWithoutJetAndMetrics());

        Address address = instance.getCluster().getLocalMember().getAddress();
        String addressString = address.getHost() + ":" + address.getPort();
        ClientConfig config = new ClientConfig();
        config.setProperty("hazelcast.client.internal.skip.member.list.during.reconnection", "true");
        config.getNetworkConfig().getClusterRoutingConfig().setRoutingMode(RoutingMode.SINGLE_MEMBER);

        config.getNetworkConfig().addAddress(addressString);
        config.getConnectionStrategyConfig().getConnectionRetryConfig().setClusterConnectTimeoutMillis(3_000);

        // There are two members, and the SINGLE_MEMBER routing client is connecting
        // to one of them. (the address of the `instance` defined above)
        HazelcastInstance client = factory.newHazelcastClient(config);

        assertEquals(2, client.getCluster().getMembers().size());
        instance.shutdown();

        // We shut down the `instance` the client is connected to but
        // there is still a member running. If the client was to try to
        // connect to members from the member list, it would succeed
        // and the assertion below would never be true.
        assertTrueEventually(() -> assertFalse(client.getLifecycleService().isRunning()));
    }