RemoteServiceDescriptor { public boolean isAvailable() { LOG.debug("Testing availability {}", baseUrl); try { return (requestFactory .fromUrl(baseUrl) .useOptionsMethod() .request() .as(getServiceDescriptorClass(), null) != null); } catch (Exception e) { LOG.warn(e.getLocalizedMessage()); return false; } } RemoteServiceDescriptor(String baseUrl, HttpJsonRequestFactory requestFactory); String getBaseUrl(); List<Link> getLinks(); Link getLink(String rel); ServiceDescriptor getServiceDescriptor(); boolean isAvailable();  }
@Test public void shouldBeAbleToConfirmAvailability() throws Exception { remoteServiceDescriptor = new RemoteServiceDescriptor(serverUrl + SERVICE_PATH, requestFactory); assertTrue(remoteServiceDescriptor.isAvailable()); }
@Test public void shouldReturnFalseOnNonAvailableServiceAvailabilityCheck() { remoteServiceDescriptor = new RemoteServiceDescriptor(serverUrl + "/non/existing/path", requestFactory); assertFalse(remoteServiceDescriptor.isAvailable()); }