Last active
December 23, 2015 10:49
-
-
Save robmadden/6624145 to your computer and use it in GitHub Desktop.
Loopj cert example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AsyncHttpClient client = new AsyncHttpClient(); | |
if (MainActivity.DEVELOPER_MODE) { | |
try { | |
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); | |
trustStore.load(null, null); | |
final SSLSocketFactory sf = CustomSSLSocketFactory.getSSLSocketFactory(context); | |
sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); | |
client.setSSLSocketFactory(sf); | |
} catch (final Exception e) { | |
Log.d(TAG, "Failed to create keystore"); | |
} | |
} | |
final String url = getSafeUrl(); | |
final RequestParams params = getParameters(); | |
Log.d(TAG, new StringBuilder("POST REQUEST: ").append(url).append(" with params: ").append(params.toString()).toString()); | |
client.post(context, url, params, createAsyncResponseListener()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment