public SSLContext createSslContextFromCa() {
        try {
            CertificateFactory factory = CertificateFactory.getInstance("X.509");
            Certificate trustedCa = factory.generateCertificate(
                new ByteArrayInputStream(
                    caCertAsBytes()
                        .orElseThrow(() -> new IllegalStateException("CA cert under " + certPath + " not found."))
                )
            );
            KeyStore trustStore = KeyStore.getInstance("pkcs12");
            trustStore.load(null, null);
            trustStore.setCertificateEntry("ca", trustedCa);

            final SSLContext sslContext = SSLContext.getInstance("TLSv1.3");
            TrustManagerFactory tmfactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
            tmfactory.init(trustStore);
            sslContext.init(null, tmfactory.getTrustManagers(), null);
            return sslContext;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
A SSL context based on the self-signed CA, so that using this SSL Context allows to connect to the Elasticsearch service
@return a customized SSL Context
modules/elasticsearch/src/main/java/org/testcontainers/elasticsearch/ElasticsearchContainer.java