@Test public void baseTest() throws IOException { final String mockBody = this.getClass().getName() + "baseTest"; final HttpUrl mockUrl = mockServ.url("/"); mockServ.enqueue(new MockResponse().setResponseCode(200).setBody(mockBody)); OkHttpScratch okHttp = new OkHttpScratch.Builder().build(); OkHttpScratch.ResponseData rep = okHttp.get(mockUrl.toString()); assertEquals(rep.getCode(), 200); assertEquals(rep.getBody(), mockBody); assertFalse("Response Headers", rep.getHeaders().isEmpty()); assertEquals(rep.getHeaders().get("Content-Length"), String.format("%d", mockBody.length())); }
public ResponseData get(String url) throws IOException { final Request req = new Request.Builder().url(url).build(); final Response rep = client.newCall(req).execute(); return toResponseData(rep); }
OkHttpScratch { public ResponseData get(String url) throws IOException { final Request req = new Request.Builder().url(url).build(); final Response rep = client.newCall(req).execute(); return toResponseData(rep); } }
OkHttpScratch { public ResponseData get(String url) throws IOException { final Request req = new Request.Builder().url(url).build(); final Response rep = client.newCall(req).execute(); return toResponseData(rep); } private  OkHttpScratch(OkHttpClient client); }
OkHttpScratch { public ResponseData get(String url) throws IOException { final Request req = new Request.Builder().url(url).build(); final Response rep = client.newCall(req).execute(); return toResponseData(rep); } private  OkHttpScratch(OkHttpClient client); void shutdownClient(); void getAsync(String url, AsyncCallback act); ResponseData get(String url); }
OkHttpScratch { public ResponseData get(String url) throws IOException { final Request req = new Request.Builder().url(url).build(); final Response rep = client.newCall(req).execute(); return toResponseData(rep); } private  OkHttpScratch(OkHttpClient client); void shutdownClient(); void getAsync(String url, AsyncCallback act); ResponseData get(String url);  }