@Override
    public Connector build(Server server, MetricRegistry metrics, String name, @Nullable ThreadPool threadPool) {
        final HttpConfiguration httpConfig = buildHttpConfiguration();

        final HttpConnectionFactory httpConnectionFactory = buildHttpConnectionFactory(httpConfig);

        final SslContextFactory.Server sslContextFactory = configureSslContextFactory(new SslContextFactory.Server());
        sslContextFactory.addEventListener(logSslParameters(sslContextFactory));

        server.addBean(sslContextFactory);
        server.addBean(new SslReload(sslContextFactory, this::configureSslContextFactory));

        final SslConnectionFactory sslConnectionFactory =
                new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.toString());

        final Scheduler scheduler = new ScheduledExecutorScheduler();

        final ByteBufferPool bufferPool = buildBufferPool();

        return buildConnector(server, scheduler, bufferPool, name, threadPool,
                              new InstrumentedConnectionFactory(
                                      sslConnectionFactory,
                                      metrics.timer(httpConnections())),
                                      httpConnectionFactory);
    }
@Test
    void testBuild() throws Exception {
        final HttpsConnectorFactory https = new HttpsConnectorFactory();
        https.setBindHost("127.0.0.1");
        https.setPort(8443);

        https.setKeyStorePath("/etc/app/server.ks");
        https.setKeyStoreType("JKS");
        https.setKeyStorePassword("correct_horse");
        https.setKeyStoreProvider("BC");
        https.setTrustStorePath("/etc/app/server.ts");
        https.setTrustStoreType("JKS");
        https.setTrustStorePassword("battery_staple");
        https.setTrustStoreProvider("BC");

        https.setKeyManagerPassword("new_overlords");
        https.setNeedClientAuth(true);
        https.setWantClientAuth(true);
        https.setCertAlias("alt_server");
        https.setCrlPath(new File("/etc/ctr_list.txt"));
        https.setEnableCRLDP(true);
        https.setEnableOCSP(true);
        https.setMaxCertPathLength(4);
        https.setOcspResponderUrl(new URI("http://windc1/ocsp"));
        https.setJceProvider("BC");
        https.setAllowRenegotiation(false);
        https.setEndpointIdentificationAlgorithm("HTTPS");
        https.setValidateCerts(true);
        https.setValidatePeers(true);
        https.setSupportedProtocols(Arrays.asList("TLSv1.1", "TLSv1.2"));
        https.setSupportedCipherSuites(Arrays.asList("TLS_DHE_RSA.*", "TLS_ECDHE.*"));

        final Server server = new Server();
        final MetricRegistry metrics = new MetricRegistry();
        final ThreadPool threadPool = new QueuedThreadPool();

        try (final ServerConnector serverConnector = (ServerConnector) https.build(server, metrics, "test-https-connector", threadPool)) {
            assertThat(serverConnector.getPort()).isEqualTo(8443);
            assertThat(serverConnector.getHost()).isEqualTo("127.0.0.1");
            assertThat(serverConnector.getName()).isEqualTo("test-https-connector");
            assertThat(serverConnector.getServer()).isSameAs(server);
            assertThat(serverConnector.getScheduler()).isInstanceOf(ScheduledExecutorScheduler.class);
            assertThat(serverConnector.getExecutor()).isSameAs(threadPool);

            final InstrumentedConnectionFactory sslConnectionFactory =
                    (InstrumentedConnectionFactory) serverConnector.getConnectionFactory("ssl");
            assertThat(sslConnectionFactory).isInstanceOf(InstrumentedConnectionFactory.class);
            assertThat(sslConnectionFactory)
                    .extracting("connectionFactory")
                    .asInstanceOf(InstanceOfAssertFactories.type(SslConnectionFactory.class))
                    .extracting(SslConnectionFactory::getSslContextFactory)
                    .satisfies(sslContextFactory -> {
                        assertThat(sslContextFactory.getKeyStoreResource())
                                .isEqualTo(newResource("/etc/app/server.ks"));
                        assertThat(sslContextFactory.getKeyStoreType()).isEqualTo("JKS");
                        assertThat(sslContextFactory).extracting("_keyStorePassword")
                                .isEqualTo("correct_horse");
                        assertThat(sslContextFactory.getKeyStoreProvider()).isEqualTo("BC");
                        assertThat(sslContextFactory.getTrustStoreResource())
                                .isEqualTo(newResource("/etc/app/server.ts"));
                        assertThat(sslContextFactory.getKeyStoreType()).isEqualTo("JKS");
                        assertThat(sslContextFactory).extracting("_trustStorePassword")
                                .isEqualTo("battery_staple");
                        assertThat(sslContextFactory.getKeyStoreProvider()).isEqualTo("BC");
                        assertThat(sslContextFactory).extracting("_keyManagerPassword")
                                .isEqualTo("new_overlords");
                        assertThat(sslContextFactory.getNeedClientAuth()).isTrue();
                        assertThat(sslContextFactory.getWantClientAuth()).isTrue();
                        assertThat(sslContextFactory.getCertAlias()).isEqualTo("alt_server");
                        assertThat(sslContextFactory.getCrlPath()).isEqualTo(new File("/etc/ctr_list.txt").getAbsolutePath());
                        assertThat(sslContextFactory.isEnableCRLDP()).isTrue();
                        assertThat(sslContextFactory.isEnableOCSP()).isTrue();
                        assertThat(sslContextFactory.getMaxCertPathLength()).isEqualTo(4);
                        assertThat(sslContextFactory.getOcspResponderURL()).isEqualTo("http://windc1/ocsp");
                        assertThat(sslContextFactory.getProvider()).isEqualTo("BC");
                        assertThat(sslContextFactory.isRenegotiationAllowed()).isFalse();
                        assertThat(sslContextFactory.getEndpointIdentificationAlgorithm()).isEqualTo("HTTPS");
                        assertThat(sslContextFactory.isValidateCerts()).isTrue();
                        assertThat(sslContextFactory.isValidatePeerCerts()).isTrue();
                        assertThat(sslContextFactory.getIncludeProtocols()).containsOnly("TLSv1.1", "TLSv1.2");
                        assertThat(sslContextFactory.getIncludeCipherSuites()).containsOnly("TLS_DHE_RSA.*", "TLS_ECDHE.*");
                    });

            final ConnectionFactory httpConnectionFactory = serverConnector.getConnectionFactory("http/1.1");
            assertThat(httpConnectionFactory).isInstanceOf(HttpConnectionFactory.class);
            final HttpConfiguration httpConfiguration = ((HttpConnectionFactory) httpConnectionFactory)
                    .getHttpConfiguration();
            assertThat(httpConfiguration.getSecureScheme()).isEqualTo("https");
            assertThat(httpConfiguration.getSecurePort()).isEqualTo(8443);
            assertThat(httpConfiguration.getCustomizers()).hasAtLeastOneElementOfType(SecureRequestCustomizer.class);
        } finally {
            server.stop();
        }
    }