BlockingHttpClient extends FilteredHttpClientSupport { @Override public void close() throws IOException { interruptCheckStatusThread(); super.close(); } BlockingHttpClient(final CloseableHttpClient delegate,
                            final Config config,
                            final RemoteConnectionStatusObserver statusObserver,
                            final boolean repositoryOnline,
                            final AutoBlockConfiguration autoBlockConfiguration); RemoteConnectionStatus getStatus(); @Override void close();  }
@Test public void updateStatusWhenBlocked() throws Exception { Config config = new Config(); config.blocked = true; reset(statusObserver); BlockingHttpClient client = new BlockingHttpClient(httpClient, config, statusObserver, true, autoBlockConfiguration); client.close(); ArgumentCaptor<RemoteConnectionStatus> newStatusCaptor = ArgumentCaptor.forClass(RemoteConnectionStatus.class); verify(statusObserver).onStatusChanged(any(), newStatusCaptor.capture()); assertThat(newStatusCaptor.getValue().getType(), is(equalTo(BLOCKED))); }