public static DefaultTlsContext of(X509SslContext sslContext, PeerAuthentication peerAuthentication) {
        return new DefaultTlsContext(sslContext, TlsContext.ALLOWED_CIPHER_SUITES, TlsContext.ALLOWED_PROTOCOLS, peerAuthentication);
    }
@Test
    void can_create_sslcontext_from_credentials() {
        KeyPair keyPair = KeyUtils.generateKeypair(EC);

        X509Certificate certificate = X509CertificateBuilder
                .fromKeypair(keyPair, new X500Principal("CN=dummy"), EPOCH, Instant.now().plus(1, DAYS), SHA256_WITH_ECDSA, generateRandomSerialNumber())
                .build();

        AuthorizedPeers authorizedPeers = new AuthorizedPeers(
                singleton(
                        new PeerPolicy(
                                "dummy-policy",
                                List.of(RequiredPeerCredential.of(RequiredPeerCredential.Field.CN, "dummy")))));

        DefaultTlsContext tlsContext =
                DefaultTlsContext.of(
                        List.of(certificate), keyPair.getPrivate(), List.of(certificate), authorizedPeers,
                        AuthorizationMode.ENFORCE, PeerAuthentication.NEED, HostnameVerification.ENABLED);

        SSLEngine sslEngine = tlsContext.createSslEngine();
        assertThat(sslEngine).isNotNull();
        String[] enabledCiphers = sslEngine.getEnabledCipherSuites();
        assertThat(enabledCiphers).isNotEmpty();
        assertThat(enabledCiphers).isSubsetOf(TlsContext.ALLOWED_CIPHER_SUITES.toArray(new String[0]));

        String[] enabledProtocols = sslEngine.getEnabledProtocols();
        assertThat(enabledProtocols).contains("TLSv1.2");
    }