1111import com .parse .http .ParseHttpRequest ;
1212import com .parse .http .ParseHttpResponse ;
1313import com .parse .http .ParseNetworkInterceptor ;
14- import com . squareup . okhttp .MediaType ;
15- import com . squareup . okhttp .Protocol ;
16- import com . squareup . okhttp .Request ;
17- import com . squareup . okhttp .RequestBody ;
18- import com . squareup . okhttp .Response ;
19- import com . squareup . okhttp .ResponseBody ;
20- import com . squareup . okhttp .mockwebserver .MockResponse ;
21- import com . squareup . okhttp .mockwebserver .MockWebServer ;
22- import com . squareup . okhttp .mockwebserver .RecordedRequest ;
14+ import okhttp3 .MediaType ;
15+ import okhttp3 .Protocol ;
16+ import okhttp3 .Request ;
17+ import okhttp3 .RequestBody ;
18+ import okhttp3 .Response ;
19+ import okhttp3 .ResponseBody ;
20+ import okhttp3 .mockwebserver .MockResponse ;
21+ import okhttp3 .mockwebserver .MockWebServer ;
22+ import okhttp3 .mockwebserver .RecordedRequest ;
2323
2424import org .json .JSONException ;
2525import org .json .JSONObject ;
@@ -116,7 +116,7 @@ public void testGetOkHttpRequest() throws IOException {
116116 // Verify method
117117 assertEquals (ParseHttpRequest .Method .POST .toString (), okHttpRequest .method ());
118118 // Verify URL
119- assertEquals (url , okHttpRequest .urlString ());
119+ assertEquals (url , okHttpRequest .url (). toString ());
120120 // Verify Headers
121121 assertEquals (1 , okHttpRequest .headers (headerName ).size ());
122122 assertEquals (headerValue , okHttpRequest .headers (headerName ).get (0 ));
@@ -173,12 +173,12 @@ public MediaType contentType() {
173173 }
174174
175175 @ Override
176- public long contentLength () throws IOException {
176+ public long contentLength () {
177177 return contentLength ;
178178 }
179179
180180 @ Override
181- public BufferedSource source () throws IOException {
181+ public BufferedSource source () {
182182 Buffer buffer = new Buffer ();
183183 buffer .write (content .getBytes ());
184184 return buffer ;
@@ -252,7 +252,7 @@ public ParseHttpResponse intercept(Chain chain) throws IOException {
252252 });
253253
254254 // We do not need to add Accept-Encoding header manually, httpClient library should do that.
255- String requestUrl = server .getUrl ("/" ).toString ();
255+ String requestUrl = server .url ("/" ).toString ();
256256 ParseHttpRequest parseRequest = new ParseHttpRequest .Builder ()
257257 .setUrl (requestUrl )
258258 .setMethod (ParseHttpRequest .Method .GET )
@@ -359,7 +359,7 @@ private ParseHttpRequest generateClientRequest() throws Exception {
359359 JSONObject json = new JSONObject ();
360360 json .put ("key" , "value" );
361361 ParseHttpRequest parseRequest = new ParseHttpRequest .Builder ()
362- .setUrl (server .getUrl ("/" ).toString ())
362+ .setUrl (server .url ("/" ).toString ())
363363 .setMethod (ParseHttpRequest .Method .POST )
364364 .setBody (new ParseByteArrayHttpBody (json .toString ().getBytes (), "application/json" ))
365365 .setHeaders (headers )
@@ -370,7 +370,7 @@ private ParseHttpRequest generateClientRequest() throws Exception {
370370 // Verify the request from client, if you change the data in generateClientRequest, make
371371 // sure you also change the condition in this method otherwise tests will fail
372372 private void verifyClientRequest (ParseHttpRequest parseRequest ) throws IOException {
373- assertEquals (server .getUrl ("/" ).toString (), parseRequest .getUrl ());
373+ assertEquals (server .url ("/" ).toString (), parseRequest .getUrl ());
374374 assertEquals (ParseHttpRequest .Method .POST , parseRequest .getMethod ());
375375 assertEquals ("requestValue" , parseRequest .getHeader ("requestKey" ));
376376 assertEquals ("application/json" , parseRequest .getBody ().getContentType ());
@@ -390,7 +390,7 @@ private ParseHttpRequest generateInterceptorRequest() {
390390 ParseHttpRequest requestAgain =
391391 new ParseHttpRequest .Builder ()
392392 .addHeader ("requestKeyAgain" , "requestValueAgain" )
393- .setUrl (server .getUrl ("/test" ).toString ())
393+ .setUrl (server .url ("/test" ).toString ())
394394 .setMethod (ParseHttpRequest .Method .GET )
395395 .build ();
396396 return requestAgain ;
0 commit comments