### Question:
SSLUtils { public static SSLHandlerFactory createRestServerSSLEngineFactory(final Configuration config) throws Exception { SSLContext sslContext = createRestServerSSLContext(config); if (sslContext == null) { throw new IllegalConfigurationException("SSL is not enabled for REST endpoints."); } return new SSLHandlerFactory( sslContext, getEnabledProtocols(config), getEnabledCipherSuites(config), false, isRestSSLAuthenticationEnabled(config), -1, -1); }  static boolean isInternalSSLEnabled(Configuration sslConfig); static boolean isRestSSLEnabled(Configuration sslConfig); static boolean isRestSSLAuthenticationEnabled(Configuration sslConfig); static ServerSocketFactory createSSLServerSocketFactory(Configuration config); static SocketFactory createSSLClientSocketFactory(Configuration config); static SSLHandlerFactory createInternalServerSSLEngineFactory(final Configuration config); static SSLHandlerFactory createInternalClientSSLEngineFactory(final Configuration config); static SSLHandlerFactory createRestServerSSLEngineFactory(final Configuration config); static SSLHandlerFactory createRestClientSSLEngineFactory(final Configuration config); @Nullable static SSLContext createRestServerSSLContext(Configuration config); @Nullable static SSLContext createRestClientSSLContext(Configuration config);  }### Answer:
@Test public void testRESTServerSSL() throws Exception { Configuration serverConfig = createRestSslConfigWithKeyStore(); SSLHandlerFactory ssl = SSLUtils.createRestServerSSLEngineFactory(serverConfig); assertNotNull(ssl); }
@Test public void testRESTServerSSLDisabled() throws Exception { Configuration serverConfig = createRestSslConfigWithKeyStore(); serverConfig.setBoolean(SecurityOptions.SSL_REST_ENABLED, false); try { SSLUtils.createRestServerSSLEngineFactory(serverConfig); fail("exception expected"); } catch (IllegalConfigurationException ignored) {} }
@Test public void testRESTServerSSLBadKeystorePassword() { Configuration serverConfig = createRestSslConfigWithKeyStore(); serverConfig.setString(SecurityOptions.SSL_REST_KEYSTORE_PASSWORD, "badpassword"); try { SSLUtils.createRestServerSSLEngineFactory(serverConfig); fail("exception expected"); } catch (Exception ignored) {} }
@Test public void testRESTServerSSLBadKeyPassword() { Configuration serverConfig = createRestSslConfigWithKeyStore(); serverConfig.setString(SecurityOptions.SSL_REST_KEY_PASSWORD, "badpassword"); try { SSLUtils.createRestServerSSLEngineFactory(serverConfig); fail("exception expected"); } catch (Exception ignored) {} }