public SSLContext createContext(ContextAware context) throws NoSuchProviderException,
      NoSuchAlgorithmException, KeyManagementException,
      UnrecoverableKeyException, KeyStoreException, CertificateException {

    SSLContext sslContext = getProvider() != null ?
        SSLContext.getInstance(getProtocol(), getProvider())
        : SSLContext.getInstance(getProtocol());

    context.addInfo("SSL protocol '" + sslContext.getProtocol()
        + "' provider '" + sslContext.getProvider() + "'");

    KeyManager[] keyManagers = createKeyManagers(context);
    TrustManager[] trustManagers = createTrustManagers(context);
    SecureRandom secureRandom = createSecureRandom(context);
    sslContext.init(keyManagers, trustManagers, secureRandom);
    return sslContext;
  }
@Test
  public void testCreateDefaultContext() throws Exception {
    // should be able to create a context with no configuration at all
    assertNotNull(factoryBean.createContext(context));
    assertTrue(context.hasInfoMatching(SSL_CONFIGURATION_MESSAGE_PATTERN));
  }