public static ServerConnector createSecureSocketConnector ( Server server , String host , int port , SslStores sslStores ) { Assert . notNull ( server , "'server' must not be null" ) ; Assert . notNull ( host , "'host' must not be null" ) ; Assert . notNull ( sslStores , "'sslStores' must not be null" ) ; SslContextFactory sslContextFactory = new SslContextFactory ( sslStores . keystoreFile ( ) ) ; if ( sslStores . keystorePassword ( ) != null ) { sslContextFactory . setKeyStorePassword ( sslStores . keystorePassword ( ) ) ; } if ( sslStores . certAlias ( ) != null ) { sslContextFactory . setCertAlias ( sslStores . certAlias ( ) ) ; } if ( sslStores . trustStoreFile ( ) != null ) { sslContextFactory . setTrustStorePath ( sslStores . trustStoreFile ( ) ) ; } if ( sslStores . trustStorePassword ( ) != null ) { sslContextFactory . setTrustStorePassword ( sslStores . trustStorePassword ( ) ) ; } if ( sslStores . needsClientCert ( ) ) { sslContextFactory . setNeedClientAuth ( true ) ; sslContextFactory . setWantClientAuth ( true ) ; } HttpConnectionFactory httpConnectionFactory = createHttpConnectionFactory ( ) ; ServerConnector connector = new ServerConnector ( server , sslContextFactory , httpConnectionFactory ) ; initializeConnector ( connector , host , port ) ; return connector ; }
Creates a ssl jetty socket jetty . Keystore required truststore optional . If truststore not specified keystore will be reused .