@Override
    public ServiceStatusInfo getStatus() {
        return updater.getServiceStatusInfo();
    }
@Test
    public void downThenUpThenDown() throws Exception {
        StateV1HealthClient client = mock(StateV1HealthClient.class);

        StateV1HealthUpdater updater = new StateV1HealthUpdater("https://foo/state/v1/health", client);
        RunletExecutor executor = new RunletExecutorImpl(2);
        try (StateV1HealthMonitor monitor = new StateV1HealthMonitor(updater, executor, Duration.ofMillis(10))) {
            assertEquals(ServiceStatus.UNKNOWN, monitor.getStatus().serviceStatus());

            when(client.get()).thenReturn(HealthInfo.fromHealthStatusCode(HealthInfo.UP_STATUS_CODE));
            while (monitor.getStatus().serviceStatus() != ServiceStatus.UP) {
                try { Thread.sleep(2); } catch (InterruptedException ignored) { }
            }

            when(client.get()).thenReturn(HealthInfo.fromException(new IllegalStateException("foo")));
            while (monitor.getStatus().serviceStatus() != ServiceStatus.DOWN) {
                try { Thread.sleep(2); } catch (InterruptedException ignored) { }
            }
        }
    }