public static SslContextFactory.Server createSslContextFactory(String sslProviderString,
                                                                   PulsarSslFactory pulsarSslFactory,
                                                                   boolean requireTrustedClientCertOnConnect,
                                                                   Set<String> ciphers, Set<String> protocols) {
        return new JettySslContextFactory.Server(sslProviderString, pulsarSslFactory,
                requireTrustedClientCertOnConnect, ciphers, protocols);
    }
@Test
    public void testJettyTlsServerTls() throws Exception {
        @Cleanup("stop")
        Server server = new Server();
        List<ServerConnector> connectors = new ArrayList<>();
        PulsarSslConfiguration sslConfiguration = PulsarSslConfiguration.builder()
                .tlsTrustCertsFilePath(Resources.getResource("ssl/my-ca/ca.pem").getPath())
                .tlsCertificateFilePath(Resources.getResource("ssl/my-ca/server-ca.pem").getPath())
                .tlsKeyFilePath(Resources.getResource("ssl/my-ca/server-key.pem").getPath())
                .allowInsecureConnection(false)
                .requireTrustedClientCertOnConnect(true)
                .tlsEnabledWithKeystore(false)
                .isHttps(true)
                .build();
        PulsarSslFactory sslFactory = new DefaultPulsarSslFactory();
        sslFactory.initialize(sslConfiguration);
        sslFactory.createInternalSslContext();
        SslContextFactory factory = JettySslContextFactory.createSslContextFactory(null,
                sslFactory, true, null, null);

        ServerConnector connector = new ServerConnector(server, factory);
        connector.setPort(0);
        connectors.add(connector);
        server.setConnectors(connectors.toArray(new ServerConnector[0]));
        server.start();
        // client connect
        HttpClientBuilder httpClientBuilder = HttpClients.custom();
        RegistryBuilder<ConnectionSocketFactory> registryBuilder = RegistryBuilder.create();
        registryBuilder.register("https",
                new SSLConnectionSocketFactory(getClientSslContext(), new NoopHostnameVerifier()));
        PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(registryBuilder.build());
        httpClientBuilder.setConnectionManager(cm);
        @Cleanup
        CloseableHttpClient httpClient = httpClientBuilder.build();
        HttpGet httpGet = new HttpGet("https://localhost:" + connector.getLocalPort());
        httpClient.execute(httpGet);
    }