class SSLContextFactory {

    private static final String[] PROTOCOLS = {"TLSv1.3", "TLSv1.2", "TLSv1.1", "TLSv1"};

    /** Constructor */
    private SSLContextFactory() {
        // DO NOTHING
    }

    /**
     * Method to create an SSLContext
     *
     * @param keyStoreFilename keyStoreFilename
     * @param keyStorePassword keyStorePassword
     * @param certificateAlias certificateAlias
     * @return the return value
     * @throws GeneralSecurityException GeneralSecurityException
     * @throws IOException IOException
     */
    public static SSLContext createSSLContext(
            String keyStoreFilename, String keyStorePassword, String certificateAlias)
            throws GeneralSecurityException, IOException {<FILL_FUNCTION_BODY>}

    /**
     * Method to create an SSLContext, looping through more secure to less secure TLS protocols
     *
     * @return the return value
     * @throws GeneralSecurityException GeneralSecurityException
     */
    private static SSLContext createSSLContext() throws GeneralSecurityException {
        // Loop through potential protocols since there doesn't appear
        // to be a way to get the most secure supported protocol
        for (String protocol : PROTOCOLS) {
            try {
                return SSLContext.getInstance(protocol);
            } catch (Throwable t) {
                // DO NOTHING
            }
        }

        throw new GeneralSecurityException("No supported TLS protocols found");
    }
}

        KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());

        try (InputStream inputStream = Files.newInputStream(Paths.get(keyStoreFilename))) {
            // Load the keystore
            keyStore.load(inputStream, keyStorePassword.toCharArray());

            // Loop through the certificate aliases in the keystore
            // building a set of certificate aliases that don't match
            // the requested certificate alias
            Set<String> certificateAliasesToRemove = new HashSet<>();
            Enumeration<String> aliases = keyStore.aliases();
            while (aliases.hasMoreElements()) {
                String keyStoreCertificateAlias = aliases.nextElement();
                if (!keyStoreCertificateAlias.equals(certificateAlias)) {
                    certificateAliasesToRemove.add(keyStoreCertificateAlias);
                }
            }

            // Remove the certificate aliases that don't
            // match the requested certificate alias from the keystore
            for (String certificateAliasToRemove : certificateAliasesToRemove) {
                keyStore.deleteEntry(certificateAliasToRemove);
            }

            // Validate the keystore contains the certificate alias that is requested
            if (!keyStore.containsAlias(certificateAlias)) {
                throw new GeneralSecurityException(
                        String.format(
                                "certificate alias [%s] not found in keystore [%s]",
                                certificateAlias, keyStoreFilename));
            }

            // Create and initialize an SSLContext

            KeyManagerFactory keyManagerFactory =
                    KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());

            keyManagerFactory.init(keyStore, keyStorePassword.toCharArray());

            TrustManagerFactory trustManagerFactory =
                    TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());

            trustManagerFactory.init(keyStore);

            SSLContext sslContext = createSSLContext();

            sslContext.init(
                    keyManagerFactory.getKeyManagers(),
                    trustManagerFactory.getTrustManagers(),
                    new SecureRandom());

            return sslContext;
        }
    
<no_super_class>