Revision 4f9d1a69 src/com/rackspace/cloud/files/api/client/CustomHttpClient.java
b/src/com/rackspace/cloud/files/api/client/CustomHttpClient.java | ||
---|---|---|
29 | 29 |
public class CustomHttpClient extends DefaultHttpClient { |
30 | 30 |
|
31 | 31 |
final Context context; |
32 |
|
|
32 |
static KeyStore trusted; |
|
33 |
|
|
33 | 34 |
public CustomHttpClient(Context context) { |
34 | 35 |
super(); |
35 | 36 |
this.context = context; |
36 | 37 |
} |
37 |
|
|
38 |
|
|
38 | 39 |
@Override |
39 | 40 |
protected ClientConnectionManager createClientConnectionManager() { |
40 | 41 |
SchemeRegistry registry = new SchemeRegistry(); |
... | ... | |
46 | 47 |
|
47 | 48 |
private SSLSocketFactory newSslSocketFactory() { |
48 | 49 |
try { |
49 |
KeyStore trusted = KeyStore.getInstance("BKS"); |
|
50 |
InputStream in = context.getResources().openRawResource( |
|
51 |
R.raw.android231); |
|
52 |
try { |
|
53 |
trusted.load(in, "changeit".toCharArray()); |
|
54 |
} finally { |
|
55 |
in.close(); |
|
50 |
if(trusted == null){ |
|
51 |
trusted = KeyStore.getInstance("BKS"); |
|
52 |
InputStream in = context.getResources().openRawResource( |
|
53 |
R.raw.android231); |
|
54 |
try { |
|
55 |
trusted.load(in, "changeit".toCharArray()); |
|
56 |
} finally { |
|
57 |
in.close(); |
|
58 |
} |
|
56 | 59 |
} |
57 | 60 |
return new SSLSocketFactory(trusted); |
58 | 61 |
} catch (Exception e) { |
Also available in: Unified diff