private Optional<HttpURLConnectionFactory> getHttpURLConnectionFactory() {
        if (this.sslSocketFactory == null && this.hostnameVerifier == null) {
            return Optional.empty();
        }
        HttpURLConnectionFactory factory = new HttpURLConnectionFactory() {
            @Serial
            private static final long serialVersionUID = 7296708420276819683L;

            @Override
            public HttpURLConnection buildHttpURLConnection(URLConnection conn) {
                if (conn instanceof HttpsURLConnection httpsConnection) {
                    if (getSslSocketFactory() != null) {
                        httpsConnection.setSSLSocketFactory(getSslSocketFactory());
                    }
                    if (getHostnameVerifier() != null) {
                        httpsConnection.setHostnameVerifier(getHostnameVerifier());
                    }
                }
                return (HttpURLConnection) conn;
            }
        };
        return Optional.of(factory);
    }
<p>computeFinalRestUrl.</p>

@param context a {@link WebContext} object
@return a {@link String} object
pac4j-cas/src/main/java/org/pac4j/cas/config/CasConfiguration.java