Back to project page Download-Count-For-GitHub.
The source code is released under:
Apache License
If you think the Android project Download-Count-For-GitHub listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at */* w ww.j a v a 2s. com*/ * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Copyright 2014 Redwarp */ package net.redwarp.android.app.githubcount.network; import com.android.volley.toolbox.HurlStack; import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.OkUrlFactory; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; /** * An {@link com.android.volley.toolbox.HttpStack HttpStack} implementation which * uses OkHttp as its transport. Updated from Jack Wharton's suggestion https://gist.github.com/JakeWharton/5616899 */ public class OkHttpStack extends HurlStack { private final OkUrlFactory factory; public OkHttpStack() { this(new OkHttpClient()); } public OkHttpStack(OkHttpClient client) { if (client == null) { throw new NullPointerException("Client must not be null."); } this.factory = new OkUrlFactory(client); } @Override protected HttpURLConnection createConnection(URL url) throws IOException { return factory.open(url); } }