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) {
try {
OpenSSLContextImpl sslContext = new OpenSSLContextImpl();
sslContext.engineInit(null, trustManagers, null, mSessionCache, null);
sslContext.engineInit(null, trustManagers, null);
sslContext.engineGetClientSessionContext().setPersistentCache(mSessionCache);
return sslContext.engineGetSocketFactory();
} catch (KeyManagementException 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) {
mSslSocketFactory = sslContext.engineGetSocketFactory();

View File

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

View File

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