@Override
    public HttpMessage sendMessageToEndPoint(final URL url) {
        try (val response = this.wrappedHttpClient.execute(new HttpGet(url.toURI()))) {
            val responseCode = response.getCode();

            for (val acceptableCode : this.acceptableCodes) {
                if (responseCode == acceptableCode) {
                    LOGGER.debug("Response code received from server matched [{}].", responseCode);
                    val entity = response.getEntity();
                    try {
                        val msg = new HttpMessage(url, IOUtils.toString(entity.getContent(), StandardCharsets.UTF_8));
                        msg.setContentType(entity.getContentType());
                        msg.setResponseCode(responseCode);
                        return msg;
                    } finally {
                        EntityUtils.consumeQuietly(entity);
                    }
                }
            }
            LOGGER.warn("Response code [{}] from [{}] did not match any of the acceptable response codes.", responseCode, url);
            if (responseCode == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
                val value = response.getReasonPhrase();
                LOGGER.error("There was an error contacting the endpoint: [{}]; The error:\n[{}]", url.toExternalForm(), value);
            }
        } catch (final Exception e) {
            LoggingUtils.error(LOGGER, e);
        }

        return null;
    }
Implementation of CAS {@link HttpClient}
which delegates requests to a {@link #wrappedHttpClient} instance.

@author Jerome Leleu
@author Scott Battaglia
@author Misagh Moayyed
@since 3.1
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/http/SimpleHttpClient.java