Search in sources :

Example 1 with Parameters

use of org.apache.harmony.xnet.tests.support.MyTrustManagerFactorySpi.Parameters in project robovm by robovm.

the class MyProvider method test_engineInit_02.

/**
     * @throws InvalidAlgorithmParameterException
     * @throws NoSuchAlgorithmException
     * javax.net.ssl.TrustManagerFactorySpi#engineInit(ManagerFactoryParameters spec)
     */
public void test_engineInit_02() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException {
    factory.reset();
    Provider provider = new MyProvider();
    TrustManagerFactory tmf = TrustManagerFactory.getInstance("MyTMF", provider);
    Parameters pr = null;
    try {
        KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
        ks.load(null, null);
        pr = new Parameters(ks);
        tmf.init(pr);
    } catch (Exception e) {
        fail("Unexpected exception " + e.toString());
    }
    assertTrue(factory.isEngineInitCalled());
    assertEquals(pr, factory.getSpec());
    factory.reset();
    tmf.init((ManagerFactoryParameters) null);
    assertTrue(factory.isEngineInitCalled());
    assertNull(factory.getSpec());
}
Also used : Parameters(org.apache.harmony.xnet.tests.support.MyTrustManagerFactorySpi.Parameters) ManagerFactoryParameters(javax.net.ssl.ManagerFactoryParameters) TrustManagerFactory(javax.net.ssl.TrustManagerFactory) KeyStore(java.security.KeyStore) KeyStoreException(java.security.KeyStoreException) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) Provider(java.security.Provider)

Aggregations

InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1 KeyStore (java.security.KeyStore)1 KeyStoreException (java.security.KeyStoreException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 Provider (java.security.Provider)1 ManagerFactoryParameters (javax.net.ssl.ManagerFactoryParameters)1 TrustManagerFactory (javax.net.ssl.TrustManagerFactory)1 Parameters (org.apache.harmony.xnet.tests.support.MyTrustManagerFactorySpi.Parameters)1