private void assertRemotePropertiesServerIsAvailable ( final URL configUrl ) { new HttpClient ( ) . send ( "HEAD" , configUrl . toExternalForm ( ) , new HashMap < String , String > ( ) , null , new HttpClient . ResponseHandler < Void > ( ) { @ Override public Void handleResponse ( HttpRequest < ? > httpRequest , InputStream is , Integer statusCode , IOException e ) throws IOException { if ( e != null || statusCode != 200 ) { throw new IllegalStateException ( "Remote properties are not available at " + configUrl + ", http status code: " + statusCode , e ) ; } return null ; } } ) ; }
Does a simple HEAD request to a configuration endpoint to check if it s reachable . If not an IllegalStateException is thrown