FileDocCategorySizeDatePackage
SSLSessionCacheTest.javaAPI DocAndroid 5.1 API3569Thu Mar 12 22:22:12 GMT 2015android.net

SSLSessionCacheTest

public class SSLSessionCacheTest extends TestCase

Fields Summary
Constructors Summary
Methods Summary
public voidtestInstall_compatibleContext()

        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);
        }
    
public voidtestInstall_incompatibleContext()

        try {
            SSLSessionCache.install(
                    new SSLSessionCache(LittleMock.mock(SSLClientSessionCache.class)),
                    new FakeSSLContext());
            fail();
        } catch (IllegalArgumentException expected) {}