Back to project page cloudmine-android.
The source code is released under:
Copyright (c) 2012 CloudMine LLC, http://cloudmine.me Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software")...
If you think the Android project cloudmine-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.cloudmine.api.rest; /*from w w w .j av a2 s . c om*/ import com.android.volley.toolbox.HurlStack; import com.squareup.okhttp.OkHttpClient; import javax.net.ssl.SSLContext; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; import java.security.GeneralSecurityException; /** */ public class OkHttpStack extends HurlStack { private final OkHttpClient client; public OkHttpStack() { this(new OkHttpClient()); } public OkHttpStack(OkHttpClient client) { if (client == null) { throw new NullPointerException("Client must not be null."); } SSLContext sslContext; try { sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, null, null); } catch (GeneralSecurityException e) { throw new AssertionError(); // The system has no TLS. Just give up. } client.setSslSocketFactory(sslContext.getSocketFactory()); this.client = client; } @Override protected HttpURLConnection createConnection(URL url) throws IOException { return client.open(url); } }