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);
}