private boolean ping() throws IOException {
        RequestConfig requestConfig =
                RequestConfig.custom()
                        .setSocketTimeout(HTTP_PING_TIMEOUT)
                        .setConnectTimeout(HTTP_PING_TIMEOUT)
                        .setConnectionRequestTimeout(HTTP_PING_TIMEOUT)
                        .setRedirectsEnabled(false)
                        .build();

        CloseableHttpClient httpClient;
        if (allowAllHosts) {
            SSLContextBuilder builder = new SSLContextBuilder();
            try {
                builder.loadTrustMaterial(new TrustAllStrategy());
                SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(builder.build(), NoopHostnameVerifier.INSTANCE);
                httpClient = HttpClientBuilder.create()
                                              .setDefaultRequestConfig(requestConfig)
                                              .setRetryHandler(new DefaultHttpRequestRetryHandler(HTTP_CLIENT_RETRIES, false))
                                              .setSSLSocketFactory(socketFactory)
                                              .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
                                              .build();
            } catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) {
                throw new IOException("Unable to set self signed strategy on http wait: " + e, e);
            }
        } else {
            httpClient = HttpClientBuilder.create()
                    .setDefaultRequestConfig(requestConfig)
                    .setRetryHandler(new DefaultHttpRequestRetryHandler(HTTP_CLIENT_RETRIES, false))
                    .build();
        }

        log.debug("Checking %s %s", method.toUpperCase(), url);
        try (CloseableHttpResponse response = httpClient.execute(RequestBuilder.create(method.toUpperCase()).setUri(url).build())) {
            int responseCode = response.getStatusLine().getStatusCode();
            if (responseCode == HttpURLConnection.HTTP_NOT_IMPLEMENTED) {
                throw new IllegalArgumentException("Invalid or not supported HTTP method '" + method.toUpperCase() + "' for checking " + url);
            }
            log.debug("%s %s returned %s",method.toUpperCase(), url, responseCode);
            return responseCode >= statusMin && responseCode <= statusMax;
        } finally {
          httpClient.close();
        }
    }
Ping the given URL

@param url URL to check
@param method HTTP method to use
@param status status code to check
src/main/java/io/fabric8/maven/docker/wait/HttpPingChecker.java