public Promise<Void> gracefullyShutdownClientChannels() {
        return gracefullyShutdownClientChannels(ShutdownType.SHUTDOWN);
    }
@Test
    @SuppressWarnings("unchecked")
    void discoveryShutdown() {
        String configName = "server.outofservice.connections.shutdown";
        AbstractConfiguration configuration = ConfigurationManager.getConfigInstance();

        try {
            configuration.setProperty(configName, "true");
            EurekaClient eureka = Mockito.mock(EurekaClient.class);
            EventExecutor executor = Mockito.mock(EventExecutor.class);

            ArgumentCaptor<EurekaEventListener> captor = ArgumentCaptor.forClass(EurekaEventListener.class);
            shutdown = spy(new ClientConnectionsShutdown(channels, executor, eureka));
            verify(eureka).registerEventListener(captor.capture());
            doReturn(executor.newPromise()).when(shutdown).gracefullyShutdownClientChannels();

            EurekaEventListener listener = captor.getValue();

            listener.onEvent(new StatusChangeEvent(InstanceStatus.UP, InstanceStatus.DOWN));
            verify(executor).schedule(ArgumentMatchers.isA(Callable.class), anyLong(), eq(TimeUnit.MILLISECONDS));

            Mockito.reset(executor);
            listener.onEvent(new StatusChangeEvent(InstanceStatus.UP, InstanceStatus.OUT_OF_SERVICE));
            verify(executor).schedule(ArgumentMatchers.isA(Callable.class), anyLong(), eq(TimeUnit.MILLISECONDS));

            Mockito.reset(executor);
            listener.onEvent(new StatusChangeEvent(InstanceStatus.STARTING, InstanceStatus.OUT_OF_SERVICE));
            verify(executor, never())
                    .schedule(ArgumentMatchers.isA(Callable.class), anyLong(), eq(TimeUnit.MILLISECONDS));
        } finally {
            configuration.setProperty(configName, "false");
        }
    }