@Override
public ServerConnector create(Server server) {
HttpConfiguration httpConfiguration = new HttpConfiguration();
httpConfiguration.setSendServerVersion(false);
httpConfiguration.setSendXPoweredBy(false);
HttpConnectionFactory https = new HttpConnectionFactory(httpConfiguration);
SslContextFactory sslContextFactory = new ExternalCertificateSslContextFactory(certificateProviders);
sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);
sslContextFactory.setUseCipherSuitesOrder(true);
ServerConnector httpsConnector;
try {
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
alpn.setDefaultProtocol("h2");
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(httpConfiguration);
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory, alpn.getProtocol());
httpsConnector = new ServerConnector(server, ssl, alpn, h2, https);
} catch (IllegalStateException e) {
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory, https.getProtocol());
httpsConnector = new ServerConnector(server, ssl, https);
}
httpsConnector.setHost(ipPortPair.getIpAddress().toString());
httpsConnector.setPort(ipPortPair.getPort());
httpsConnector.setIdleTimeout(30000);
return httpsConnector;
}
}