@Override
    public void shutdown() {
        if(Monitors.isObjectRegistered(name, this)) {
            Monitors.unregisterObject(name, this);
        }
        TransportUtils.shutdown(eurekaHttpClientRef.getAndSet(null));
    }
@Test
    public void testReconnectIsEnforcedAtConfiguredInterval() throws Exception {
        final AtomicReference<EurekaHttpClient> clientRef = new AtomicReference<>(firstClient);
        when(factory.newClient()).thenAnswer(new Answer<EurekaHttpClient>() {
            @Override
            public EurekaHttpClient answer(InvocationOnMock invocation) throws Throwable {
                return clientRef.get();
            }
        });

        SessionedEurekaHttpClient httpClient = null;
        try {
            httpClient = new SessionedEurekaHttpClient("test", factory, 1);
            httpClient.getApplications();
            verify(firstClient, times(1)).getApplications();

            clientRef.set(secondClient);
            Thread.sleep(2);

            httpClient.getApplications();
            verify(secondClient, times(1)).getApplications();
        } finally {
            if (httpClient != null) {
                httpClient.shutdown();
            }
        }
    }