private static URLConnection createConnection(final String url, final String proxy) throws Exception {
        val constructedUrl = new URI(url).toURL();
        return FunctionUtils.doIf(StringUtils.isNotBlank(proxy),
                Unchecked.supplier(() -> {
                    val proxyUrl = new URI(proxy).toURL();
                    LOGGER.info("Using proxy address [{}]", proxy);
                    val proxyAddr = new InetSocketAddress(proxyUrl.getHost(), proxyUrl.getPort());
                    return constructedUrl.openConnection(new Proxy(Proxy.Type.HTTP, proxyAddr));
                }),
                Unchecked.supplier(constructedUrl::openConnection))
            .get();
    }
This is {@link ValidateEndpointCommand}.

@author Misagh Moayyed
@author John Gasper
@since 5.3.0
support/cas-server-support-shell-core/src/main/java/org/apereo/cas/shell/commands/util/ValidateEndpointCommand.java