Created
July 25, 2014 07:58
-
-
Save LOG-TAG/3233bb88ddb7e6c954ea to your computer and use it in GitHub Desktop.
OkHttpStack for OkHttp 2.0.0
This file contains hidden or 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
public class OkHttpStack extends HurlStack { | |
private final OkUrlFactory okUrlFactory; | |
public OkHttpStack() { | |
this(new OkUrlFactory(new OkHttpClient())); | |
} | |
public OkHttpStack(OkUrlFactory okUrlFactory) { | |
if (okUrlFactory == null) { | |
throw new NullPointerException("Client must not be null."); | |
} | |
this.okUrlFactory = okUrlFactory; | |
} | |
@Override | |
protected HttpURLConnection createConnection(URL url) throws IOException { | |
return okUrlFactory.open(url); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment