use of com.android.volley.toolbox.HurlStack in project AndroidNetworkDemo by dodocat.
the class RequestManager method newRequestQueue.
private RequestQueue newRequestQueue(Context context) {
RequestQueue requestQueue;
try {
String[] hosts = { "kyfw.12306.cn" };
int[] certRes = { R.raw.kyfw };
String[] certPass = { "asdfqaz" };
socketFactoryMap = new Hashtable<>(hosts.length);
for (int i = 0; i < certRes.length; i++) {
int res = certRes[i];
String password = certPass[i];
SSLSocketFactory sslSocketFactory = createSSLSocketFactory(context, res, password);
socketFactoryMap.put(hosts[i], sslSocketFactory);
}
HurlStack stack = new SelfSignSslOkHttpStack(socketFactoryMap);
requestQueue = Volley.newRequestQueue(context, stack);
requestQueue.start();
} catch (KeyStoreException | CertificateException | NoSuchAlgorithmException | KeyManagementException | IOException e) {
throw new RuntimeException(e);
}
return requestQueue;
}
use of com.android.volley.toolbox.HurlStack in project fresco by facebook.
the class SampleVolleyFactory method getRequestQueue.
public static RequestQueue getRequestQueue(Context context) {
if (sRequestQueue == null) {
File cacheDir = new File(context.getCacheDir(), VOLLEY_CACHE_DIR);
sRequestQueue = new RequestQueue(new DiskBasedCache(cacheDir, ConfigConstants.MAX_DISK_CACHE_SIZE), new BasicNetwork(new HurlStack()));
sRequestQueue.start();
}
return sRequestQueue;
}
use of com.android.volley.toolbox.HurlStack in project DesignLibrary by StylingAndroid.
the class VolleySingleton method getRequestQueue.
public RequestQueue getRequestQueue() {
if (requestQueue == null) {
Cache cache = new DiskBasedCache(context.getCacheDir(), CACHE_SIZE);
Network network = new BasicNetwork(new HurlStack());
requestQueue = new RequestQueue(cache, network);
requestQueue.start();
}
return requestQueue;
}
Aggregations