Search in sources :

Example 1 with ClientSessionContext

use of com.android.org.conscrypt.ClientSessionContext in project android_frameworks_base by AOSPA.

the class SSLSessionCacheTest method testInstall_compatibleContext.

public void testInstall_compatibleContext() throws Exception {
    final SSLContext ctx = SSLContext.getDefault();
    final SSLClientSessionCache mock = LittleMock.mock(SSLClientSessionCache.class);
    final ClientSessionContext clientCtx = (ClientSessionContext) ctx.getClientSessionContext();
    try {
        SSLSessionCache.install(new SSLSessionCache(mock), ctx);
        clientCtx.getSession("www.foogle.com", 443);
        LittleMock.verify(mock).getSessionData(LittleMock.anyString(), LittleMock.anyInt());
    } finally {
        // Restore cacheless behaviour.
        SSLSessionCache.install(null, ctx);
        clientCtx.getSession("www.foogle.com", 443);
        LittleMock.verifyNoMoreInteractions(mock);
    }
}
Also used : ClientSessionContext(com.android.org.conscrypt.ClientSessionContext) SSLContext(javax.net.ssl.SSLContext) SSLClientSessionCache(com.android.org.conscrypt.SSLClientSessionCache)

Example 2 with ClientSessionContext

use of com.android.org.conscrypt.ClientSessionContext in project platform_frameworks_base by android.

the class SSLSessionCacheTest method testInstall_compatibleContext.

public void testInstall_compatibleContext() throws Exception {
    final SSLContext ctx = SSLContext.getDefault();
    final SSLClientSessionCache mock = Mockito.mock(SSLClientSessionCache.class);
    final ClientSessionContext clientCtx = (ClientSessionContext) ctx.getClientSessionContext();
    try {
        SSLSessionCache.install(new SSLSessionCache(mock), ctx);
        clientCtx.getSession("www.foogle.com", 443);
        Mockito.verify(mock).getSessionData(Mockito.anyString(), Mockito.anyInt());
    } finally {
        // Restore cacheless behaviour.
        SSLSessionCache.install(null, ctx);
        clientCtx.getSession("www.foogle.com", 443);
        Mockito.verifyNoMoreInteractions(mock);
    }
}
Also used : ClientSessionContext(com.android.org.conscrypt.ClientSessionContext) SSLContext(javax.net.ssl.SSLContext) SSLClientSessionCache(com.android.org.conscrypt.SSLClientSessionCache)

Example 3 with ClientSessionContext

use of com.android.org.conscrypt.ClientSessionContext in project android_frameworks_base by DirtyUnicorns.

the class SSLSessionCacheTest method testInstall_compatibleContext.

public void testInstall_compatibleContext() throws Exception {
    final SSLContext ctx = SSLContext.getDefault();
    final SSLClientSessionCache mock = LittleMock.mock(SSLClientSessionCache.class);
    final ClientSessionContext clientCtx = (ClientSessionContext) ctx.getClientSessionContext();
    try {
        SSLSessionCache.install(new SSLSessionCache(mock), ctx);
        clientCtx.getSession("www.foogle.com", 443);
        LittleMock.verify(mock).getSessionData(LittleMock.anyString(), LittleMock.anyInt());
    } finally {
        // Restore cacheless behaviour.
        SSLSessionCache.install(null, ctx);
        clientCtx.getSession("www.foogle.com", 443);
        LittleMock.verifyNoMoreInteractions(mock);
    }
}
Also used : ClientSessionContext(com.android.org.conscrypt.ClientSessionContext) SSLContext(javax.net.ssl.SSLContext) SSLClientSessionCache(com.android.org.conscrypt.SSLClientSessionCache)

Example 4 with ClientSessionContext

use of com.android.org.conscrypt.ClientSessionContext in project android_frameworks_base by ResurrectionRemix.

the class SSLSessionCacheTest method testInstall_compatibleContext.

public void testInstall_compatibleContext() throws Exception {
    final SSLContext ctx = SSLContext.getDefault();
    final SSLClientSessionCache mock = LittleMock.mock(SSLClientSessionCache.class);
    final ClientSessionContext clientCtx = (ClientSessionContext) ctx.getClientSessionContext();
    try {
        SSLSessionCache.install(new SSLSessionCache(mock), ctx);
        clientCtx.getSession("www.foogle.com", 443);
        LittleMock.verify(mock).getSessionData(LittleMock.anyString(), LittleMock.anyInt());
    } finally {
        // Restore cacheless behaviour.
        SSLSessionCache.install(null, ctx);
        clientCtx.getSession("www.foogle.com", 443);
        LittleMock.verifyNoMoreInteractions(mock);
    }
}
Also used : ClientSessionContext(com.android.org.conscrypt.ClientSessionContext) SSLContext(javax.net.ssl.SSLContext) SSLClientSessionCache(com.android.org.conscrypt.SSLClientSessionCache)

Example 5 with ClientSessionContext

use of com.android.org.conscrypt.ClientSessionContext in project android_frameworks_base by crdroidandroid.

the class SSLSessionCacheTest method testInstall_compatibleContext.

public void testInstall_compatibleContext() throws Exception {
    final SSLContext ctx = SSLContext.getDefault();
    final SSLClientSessionCache mock = LittleMock.mock(SSLClientSessionCache.class);
    final ClientSessionContext clientCtx = (ClientSessionContext) ctx.getClientSessionContext();
    try {
        SSLSessionCache.install(new SSLSessionCache(mock), ctx);
        clientCtx.getSession("www.foogle.com", 443);
        LittleMock.verify(mock).getSessionData(LittleMock.anyString(), LittleMock.anyInt());
    } finally {
        // Restore cacheless behaviour.
        SSLSessionCache.install(null, ctx);
        clientCtx.getSession("www.foogle.com", 443);
        LittleMock.verifyNoMoreInteractions(mock);
    }
}
Also used : ClientSessionContext(com.android.org.conscrypt.ClientSessionContext) SSLContext(javax.net.ssl.SSLContext) SSLClientSessionCache(com.android.org.conscrypt.SSLClientSessionCache)

Aggregations

ClientSessionContext (com.android.org.conscrypt.ClientSessionContext)5 SSLClientSessionCache (com.android.org.conscrypt.SSLClientSessionCache)5 SSLContext (javax.net.ssl.SSLContext)5