Merge "Remove SSLContextImpl.engineInit(..) that takes persistent cache arguments" into gingerbread

This commit is contained in:
Brian Carlstrom
2010-09-14 11:15:01 -07:00
committed by Android (Google) Code Review
4 changed files with 20 additions and 13 deletions

View File

@@ -211,7 +211,8 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
private SSLSocketFactory makeSocketFactory(TrustManager[] trustManagers) { private SSLSocketFactory makeSocketFactory(TrustManager[] trustManagers) {
try { try {
OpenSSLContextImpl sslContext = new OpenSSLContextImpl(); OpenSSLContextImpl sslContext = new OpenSSLContextImpl();
sslContext.engineInit(null, trustManagers, null, mSessionCache, null); sslContext.engineInit(null, trustManagers, null);
sslContext.engineGetClientSessionContext().setPersistentCache(mSessionCache);
return sslContext.engineGetSocketFactory(); return sslContext.engineGetSocketFactory();
} catch (KeyManagementException e) { } catch (KeyManagementException e) {
Log.wtf(TAG, e); Log.wtf(TAG, e);

View File

@@ -98,7 +98,8 @@ public class HttpsConnection extends Connection {
} }
}; };
sslContext.engineInit(null, trustManagers, null, cache, null); sslContext.engineInit(null, trustManagers, null);
sslContext.engineGetClientSessionContext().setPersistentCache(cache);
synchronized (HttpsConnection.class) { synchronized (HttpsConnection.class) {
mSslSocketFactory = sslContext.engineGetSocketFactory(); mSslSocketFactory = sslContext.engineGetSocketFactory();

View File

@@ -211,17 +211,17 @@ public class SSLPerformanceTest extends AndroidTestCase {
deleteDirectory(); deleteDirectory();
OpenSSLContextImpl sslContext = new OpenSSLContextImpl(); OpenSSLContextImpl sslContext = new OpenSSLContextImpl();
sslContext.engineInit(null, null, null, sslContext.engineInit(null, null, null);
FileClientSessionCache.usingDirectory(getCacheDirectory()), sslContext.engineGetClientSessionContext().setPersistentCache(
null); FileClientSessionCache.usingDirectory(getCacheDirectory()));
// Make sure www.google.com is in the cache. // Make sure www.google.com is in the cache.
getVerisignDotCom(sslContext); getVerisignDotCom(sslContext);
// Re-initialize so we hit the file cache. // Re-initialize so we hit the file cache.
sslContext.engineInit(null, null, null, sslContext.engineInit(null, null, null);
FileClientSessionCache.usingDirectory(getCacheDirectory()), sslContext.engineGetClientSessionContext().setPersistentCache(
null); FileClientSessionCache.usingDirectory(getCacheDirectory()));
Stopwatch stopwatch = new Stopwatch(); Stopwatch stopwatch = new Stopwatch();

View File

@@ -911,7 +911,8 @@ public class SSLSocketTest extends TestCase {
// Cache size = 2. // Cache size = 2.
FakeClientSessionCache fakeCache = new FakeClientSessionCache(); FakeClientSessionCache fakeCache = new FakeClientSessionCache();
context.engineInit(null, null, null, fakeCache, null); context.engineInit(null, null, null);
context.engineGetClientSessionContext().setPersistentCache(fakeCache);
SSLSocketFactory socketFactory = context.engineGetSocketFactory(); SSLSocketFactory socketFactory = context.engineGetSocketFactory();
context.engineGetClientSessionContext().setSessionCacheSize(2); context.engineGetClientSessionContext().setSessionCacheSize(2);
makeRequests(socketFactory); makeRequests(socketFactory);
@@ -933,7 +934,8 @@ public class SSLSocketTest extends TestCase {
// Cache size = 3. // Cache size = 3.
fakeCache = new FakeClientSessionCache(); fakeCache = new FakeClientSessionCache();
context.engineInit(null, null, null, fakeCache, null); context.engineInit(null, null, null);
context.engineGetClientSessionContext().setPersistentCache(fakeCache);
socketFactory = context.engineGetSocketFactory(); socketFactory = context.engineGetSocketFactory();
context.engineGetClientSessionContext().setSessionCacheSize(3); context.engineGetClientSessionContext().setSessionCacheSize(3);
makeRequests(socketFactory); makeRequests(socketFactory);
@@ -952,7 +954,8 @@ public class SSLSocketTest extends TestCase {
// Cache size = 4. // Cache size = 4.
fakeCache = new FakeClientSessionCache(); fakeCache = new FakeClientSessionCache();
context.engineInit(null, null, null, fakeCache, null); context.engineInit(null, null, null);
context.engineGetClientSessionContext().setPersistentCache(fakeCache);
socketFactory = context.engineGetSocketFactory(); socketFactory = context.engineGetSocketFactory();
context.engineGetClientSessionContext().setSessionCacheSize(4); context.engineGetClientSessionContext().setSessionCacheSize(4);
makeRequests(socketFactory); makeRequests(socketFactory);
@@ -1010,7 +1013,8 @@ public class SSLSocketTest extends TestCase {
try { try {
ClientSessionCacheProxy cacheProxy ClientSessionCacheProxy cacheProxy
= new ClientSessionCacheProxy(fileCache); = new ClientSessionCacheProxy(fileCache);
context.engineInit(null, null, null, cacheProxy, null); context.engineInit(null, null, null);
context.engineGetClientSessionContext().setPersistentCache(cacheProxy);
SSLSocketFactory socketFactory = context.engineGetSocketFactory(); SSLSocketFactory socketFactory = context.engineGetSocketFactory();
context.engineGetClientSessionContext().setSessionCacheSize(1); context.engineGetClientSessionContext().setSessionCacheSize(1);
makeRequests(socketFactory); makeRequests(socketFactory);
@@ -1033,7 +1037,8 @@ public class SSLSocketTest extends TestCase {
// Try again now that file-based cache is populated. // Try again now that file-based cache is populated.
fileCache = FileClientSessionCache.usingDirectory(cacheDir); fileCache = FileClientSessionCache.usingDirectory(cacheDir);
cacheProxy = new ClientSessionCacheProxy(fileCache); cacheProxy = new ClientSessionCacheProxy(fileCache);
context.engineInit(null, null, null, cacheProxy, null); context.engineInit(null, null, null);
context.engineGetClientSessionContext().setPersistentCache(cacheProxy);
socketFactory = context.engineGetSocketFactory(); socketFactory = context.engineGetSocketFactory();
context.engineGetClientSessionContext().setSessionCacheSize(1); context.engineGetClientSessionContext().setSessionCacheSize(1);
makeRequests(socketFactory); makeRequests(socketFactory);