Home
last modified time | relevance | path

Searched refs:MockResponse (Results 1 – 25 of 40) sorted by relevance

12

/external/okhttp/okhttp-android-support/src/test/java/com/squareup/okhttp/internal/huc/
DResponseCacheTest.java27 import com.squareup.okhttp.mockwebserver.MockResponse;
184 MockResponse mockResponse = new MockResponse() in assertCached()
231 MockResponse mockResponse = new MockResponse() in testResponseCaching()
260 server.enqueue(new MockResponse() in secureResponseCaching()
290 server.enqueue(new MockResponse() in responseCachingAndRedirects()
295 server.enqueue(new MockResponse() in responseCachingAndRedirects()
299 server.enqueue(new MockResponse() in responseCachingAndRedirects()
310 server.enqueue(new MockResponse() in redirectToCachedResult()
313 server.enqueue(new MockResponse() in redirectToCachedResult()
316 server.enqueue(new MockResponse() in redirectToCachedResult()
[all …]
DCacheAdapterTest.java23 import com.squareup.okhttp.mockwebserver.MockResponse;
80 final URL serverUrl = configureServer(new MockResponse()); in get_httpGet()
102 final URL serverUrl = configureHttpsServer(new MockResponse()); in get_httpsGet()
130 new MockResponse() in put_httpGet()
170 new MockResponse() in put_httpPost()
207 final URL serverUrl = configureHttpsServer(new MockResponse()); in put_httpsGet()
252 private URL configureServer(MockResponse mockResponse) throws Exception { in configureServer()
258 private URL configureHttpsServer(MockResponse mockResponse) throws Exception { in configureHttpsServer()
/external/okhttp/okhttp-tests/src/test/java/com/squareup/okhttp/
DCacheTest.java23 import com.squareup.okhttp.mockwebserver.MockResponse;
158 MockResponse mockResponse = new MockResponse() in assertCached()
211 MockResponse mockResponse = new MockResponse() in testResponseCaching()
248 server.enqueue(new MockResponse() in secureResponseCaching()
283 server.enqueue(new MockResponse() in responseCachingAndRedirects()
288 server.enqueue(new MockResponse() in responseCachingAndRedirects()
292 server.enqueue(new MockResponse() in responseCachingAndRedirects()
308 server.enqueue(new MockResponse() in redirectToCachedResult()
311 server.enqueue(new MockResponse() in redirectToCachedResult()
314 server.enqueue(new MockResponse() in redirectToCachedResult()
[all …]
DURLConnectionTest.java27 import com.squareup.okhttp.mockwebserver.MockResponse;
133 server.enqueue(new MockResponse()); in requestHeaders()
201 server.enqueue(new MockResponse().setStatus("HTTP/1.0 200 Fantastic") in responseHeaders()
235 server.enqueue(new MockResponse().setStatus("HTP/1.1 200 OK")); in serverSendsInvalidResponseHeaders()
246 server.enqueue(new MockResponse().setStatus("HTTP/1.1 2147483648 OK")); in serverSendsInvalidCodeTooLarge()
257 server.enqueue(new MockResponse().setStatus("HTTP/1.1 00a OK")); in serverSendsInvalidCodeNotANumber()
268 server.enqueue(new MockResponse().setStatus(" HTTP/1.1 2147483648 OK")); in serverSendsUnnecessaryWhitespace()
303 server.enqueue(new MockResponse().setBody("abc")); in testRequestBodySurvivesRetries()
321 server.enqueue(new MockResponse().setBody("A")); in getErrorStreamOnSuccessfulRequest()
328 server.enqueue(new MockResponse().setResponseCode(404).setBody("A")); in getErrorStreamOnUnsuccessfulRequest()
[all …]
DConnectionReuseTest.java19 import com.squareup.okhttp.mockwebserver.MockResponse;
41 server.enqueue(new MockResponse().setBody("a")); in connectionsAreReused()
42 server.enqueue(new MockResponse().setBody("b")); in connectionsAreReused()
52 server.enqueue(new MockResponse().setBody("a")); in connectionsAreReusedWithHttp2()
53 server.enqueue(new MockResponse().setBody("b")); in connectionsAreReusedWithHttp2()
62 server.enqueue(new MockResponse().setBody("a")); in connectionsAreNotReusedWithRequestConnectionClose()
63 server.enqueue(new MockResponse().setBody("b")); in connectionsAreNotReusedWithRequestConnectionClose()
76 server.enqueue(new MockResponse() in connectionsAreNotReusedWithResponseConnectionClose()
79 server.enqueue(new MockResponse().setBody("b")); in connectionsAreNotReusedWithResponseConnectionClose()
91 server.enqueue(new MockResponse() in connectionsAreNotReusedWithUnknownLengthResponseBody()
[all …]
DCallTest.java27 import com.squareup.okhttp.mockwebserver.MockResponse;
111 server.enqueue(new MockResponse().setBody("abc").addHeader("Content-Type: text/plain")); in get()
132 server.enqueue(new MockResponse()); in buildRequestUsingHttpUrl()
164 server.enqueue(new MockResponse().setResponseCode(500)); in getReturns500()
191 server.enqueue(new MockResponse() in repeatedHeaderNames()
220 server.enqueue(new MockResponse()); in getWithRequestBody()
230 server.enqueue(new MockResponse().addHeader("Content-Type: text/plain")); in head()
265 server.enqueue(new MockResponse().setBody("abc")); in post()
299 server.enqueue(new MockResponse().setBody("abc")); in postZeroLength()
372 server.enqueue(new MockResponse().setResponseCode(401)); in postBodyRetransmittedAfterAuthorizationFail()
[all …]
DInterceptorTest.java18 import com.squareup.okhttp.mockwebserver.MockResponse;
79 server.enqueue(new MockResponse().setResponseCode(500)); in networkInterceptorsCannotShortCircuitResponses()
108 server.enqueue(new MockResponse()); in networkInterceptorsCannotCallProceedMultipleTimes()
109 server.enqueue(new MockResponse()); in networkInterceptorsCannotCallProceedMultipleTimes()
133 server.enqueue(new MockResponse().setResponseCode(500)); in networkInterceptorsCannotChangeServerAddress()
161 server.enqueue(new MockResponse()); in networkInterceptorsHaveConnectionAccess()
178 server.enqueue(new MockResponse() in networkInterceptorsObserveNetworkHeaders()
214 server.enqueue(new MockResponse()); in networkInterceptorsCanChangeRequestMethodFromGetToPost()
251 server.enqueue(new MockResponse()); in rewriteRequestToServer()
287 server.enqueue(new MockResponse() in rewriteResponseFromServer()
[all …]
DSocksProxyTest.java18 import com.squareup.okhttp.mockwebserver.MockResponse;
48 server.enqueue(new MockResponse().setBody("abc")); in proxy()
49 server.enqueue(new MockResponse().setBody("def")); in proxy()
67 server.enqueue(new MockResponse().setBody("abc")); in proxySelector()
91 server.enqueue(new MockResponse().setBody("abc")); in checkRemoteDNSResolve()
/external/okhttp/mockwebserver/src/main/java/com/squareup/okhttp/mockwebserver/
DMockResponse.java28 public final class MockResponse implements Cloneable { class
50 public MockResponse() { in MockResponse() method in MockResponse
54 @Override public MockResponse clone() { in clone()
56 MockResponse result = (MockResponse) super.clone(); in clone()
70 public MockResponse setResponseCode(int code) { in setResponseCode()
74 public MockResponse setStatus(String status) { in setStatus()
88 public MockResponse clearHeaders() { in clearHeaders()
97 public MockResponse addHeader(String header) { in addHeader()
106 public MockResponse addHeader(String name, Object value) { in addHeader()
116 public MockResponse addHeaderLenient(String name, Object value) { in addHeaderLenient()
[all …]
DQueueDispatcher.java29 protected final BlockingQueue<MockResponse> responseQueue = new LinkedBlockingQueue<>();
30 private MockResponse failFastResponse;
32 @Override public MockResponse dispatch(RecordedRequest request) throws InterruptedException { in dispatch()
37 return new MockResponse().setResponseCode(HttpURLConnection.HTTP_NOT_FOUND); in dispatch()
48 @Override public MockResponse peek() { in peek()
49 MockResponse peek = responseQueue.peek(); in peek()
55 public void enqueueResponse(MockResponse response) { in enqueueResponse()
60 MockResponse failFastResponse = failFast in setFailFast()
61 ? new MockResponse().setResponseCode(HttpURLConnection.HTTP_NOT_FOUND) in setFailFast()
66 public void setFailFast(MockResponse failFastResponse) { in setFailFast()
DDispatcher.java24 public abstract MockResponse dispatch(RecordedRequest request) throws InterruptedException; in dispatch()
33 public MockResponse peek() { in peek()
34 return new MockResponse().setSocketPolicy(SocketPolicy.KEEP_OPEN); in peek()
/external/okhttp/okhttp-urlconnection/src/test/java/com/squareup/okhttp/
DUrlConnectionCacheTest.java23 import com.squareup.okhttp.mockwebserver.MockResponse;
167 MockResponse response = new MockResponse() in assertCached()
215 MockResponse response = in testResponseCaching()
216 new MockResponse().addHeader("Last-Modified: " + formatDate(-1, TimeUnit.HOURS)) in testResponseCaching()
250 server.enqueue(new MockResponse().addHeader("Last-Modified: " + formatDate(-1, TimeUnit.HOURS)) in secureResponseCaching()
283 server.enqueue(new MockResponse().addHeader("Last-Modified: " + formatDate(-1, TimeUnit.HOURS)) in responseCachingAndRedirects()
287 server.enqueue(new MockResponse().addHeader("Last-Modified: " + formatDate(-1, TimeUnit.HOURS)) in responseCachingAndRedirects()
290 server.enqueue(new MockResponse().setBody("DEF")); in responseCachingAndRedirects()
304 server.enqueue(new MockResponse().addHeader("Cache-Control: max-age=60").setBody("ABC")); in redirectToCachedResult()
305 server.enqueue(new MockResponse().setResponseCode(HttpURLConnection.HTTP_MOVED_PERM) in redirectToCachedResult()
[all …]
DOkUrlFactoryTest.java8 import com.squareup.okhttp.mockwebserver.MockResponse;
55 server.enqueue(new MockResponse().setResponseCode(407)); in originServerSends407()
66 server.enqueue(new MockResponse().setBody("Isla Sorna")); in networkResponseSourceHeader()
74 server.enqueue(new MockResponse().setResponseCode(404)); in networkFailureResponseSourceHeader()
82 server.enqueue(new MockResponse() in conditionalCacheHitResponseSourceHeaders()
86 server.enqueue(new MockResponse().setResponseCode(304)); in conditionalCacheHitResponseSourceHeaders()
98 server.enqueue(new MockResponse() in conditionalCacheMissResponseSourceHeaders()
102 server.enqueue(new MockResponse().setBody("Isla Sorna")); in conditionalCacheMissResponseSourceHeaders()
114 server.enqueue(new MockResponse() in cacheResponseSourceHeaders()
128 server.enqueue(new MockResponse().setBody("Isla Nublar")); in noneResponseSourceHeaders()
[all …]
/external/mockwebserver/src/main/java/com/google/mockwebserver/
DMockResponse.java34 public final class MockResponse implements Cloneable { class
56 public MockResponse() { in MockResponse() method in MockResponse
60 @Override public MockResponse clone() { in clone()
62 MockResponse result = (MockResponse) super.clone(); in clone()
77 public MockResponse setResponseCode(int code) { in setResponseCode()
82 public MockResponse setStatus(String status) { in setStatus()
98 public MockResponse clearHeaders() { in clearHeaders()
107 public MockResponse addHeader(String header) { in addHeader()
116 public MockResponse addHeader(String name, Object value) { in addHeader()
124 public MockResponse setHeader(String name, Object value) { in setHeader()
[all …]
DQueueDispatcher.java27 protected final BlockingQueue<MockResponse> responseQueue
28 = new LinkedBlockingQueue<MockResponse>();
29 private MockResponse failFastResponse;
31 @Override public MockResponse dispatch(RecordedRequest request) throws InterruptedException { in dispatch()
36 return new MockResponse() in dispatch()
48 @Override public MockResponse peek() { in peek()
49 MockResponse peek = responseQueue.peek(); in peek()
55 public void enqueueResponse(MockResponse response) { in enqueueResponse()
60 MockResponse failFastResponse = failFast in setFailFast()
61 ? new MockResponse().setResponseCode(HttpURLConnection.HTTP_NOT_FOUND) in setFailFast()
[all …]
DDispatcher.java26 public abstract MockResponse dispatch(RecordedRequest request) throws InterruptedException; in dispatch()
35 public MockResponse peek() { in peek()
36 return new MockResponse().setSocketPolicy(SocketPolicy.KEEP_OPEN); in peek()
/external/mockwebserver/src/test/java/com/google/mockwebserver/
DMockWebServerTest.java70 MockResponse response = new MockResponse(); in testDefaultMockResponse()
76 MockResponse response = new MockResponse().setBody("ABC"); in testSetBodyAdjustsHeaders()
87 MockResponse response = new MockResponse() in testMockResponseAddHeader()
96 MockResponse response = new MockResponse() in testMockResponseSetHeader()
107 server.enqueue(new MockResponse().setBody("hello world")); in testRegularResponse()
125 server.enqueue(new MockResponse() in testRedirect()
129 server.enqueue(new MockResponse().setBody("This is the new location!")); in testRedirect()
155 server.enqueue(new MockResponse().setBody("enqueued in the background")); in testDispatchBlocksWaitingForEnqueue()
166 server.enqueue(new MockResponse() in testNonHexadecimalChunkSize()
182 server.enqueue(new MockResponse() in testResponseTimeout()
[all …]
/external/okhttp/mockwebserver/src/test/java/com/squareup/okhttp/mockwebserver/
DMockWebServerTest.java53 MockResponse response = new MockResponse(); in defaultMockResponse()
59 MockResponse response = new MockResponse().setBody("ABC"); in setBodyAdjustsHeaders()
66 MockResponse response = new MockResponse() in mockResponseAddHeader()
74 MockResponse response = new MockResponse() in mockResponseSetHeader()
84 server.enqueue(new MockResponse().setBody("hello world")); in regularResponse()
100 server.enqueue(new MockResponse() in redirect()
104 server.enqueue(new MockResponse().setBody("This is the new location!")); in redirect()
128 server.enqueue(new MockResponse().setBody("enqueued in the background")); in dispatchBlocksWaitingForEnqueue()
139 server.enqueue(new MockResponse() in nonHexadecimalChunkSize()
154 server.enqueue(new MockResponse() in responseTimeout()
[all …]
/external/okhttp/okhttp-tests/src/test/java/com/squareup/okhttp/internal/framed/
DHttpOverSpdyTest.java27 import com.squareup.okhttp.mockwebserver.MockResponse;
97 MockResponse response = new MockResponse().setBody("ABCDE").setStatus("HTTP/1.1 200 Sweet"); in get()
112 server.enqueue(new MockResponse()); in emptyResponse()
121 server.enqueue(new MockResponse().setBody("ABCDE")); in noDefaultContentLengthOnStreamingPost()
136 server.enqueue(new MockResponse().setBody("ABCDE")); in userSuppliedContentLengthHeader()
151 server.enqueue(new MockResponse().setBody("ABCDE")); in closeAfterFlush()
168 server.enqueue(new MockResponse().setBody("ABCDE")); in setFixedLengthStreamingModeSetsContentLength()
183 server.enqueue(new MockResponse().setBody("ABCDEF")); in spdyConnectionReuse()
184 server.enqueue(new MockResponse().setBody("GHIJKL")); in spdyConnectionReuse()
197 server.enqueue(new MockResponse().setBody("A")); in synchronousSpdyRequest()
[all …]
DHttpOverHttp2Test.java20 import com.squareup.okhttp.mockwebserver.MockResponse;
37 new MockResponse().setBody("bar").setStatus("HTTP/1.1 200 Sweet")); in serverSendsPushPromise_GET()
38 MockResponse response = new MockResponse() in serverSendsPushPromise_GET()
61 new MockResponse().setStatus("HTTP/1.1 204 Sweet")); in serverSendsPushPromise_HEAD()
62 MockResponse response = new MockResponse() in serverSendsPushPromise_HEAD()
92 server.enqueue(new MockResponse().withSettings(settings)); in settingsLimitsMaxConcurrentStreams()
96 server.enqueue(new MockResponse().setBody("ABC")); in settingsLimitsMaxConcurrentStreams()
97 server.enqueue(new MockResponse().setBody("DEF")); in settingsLimitsMaxConcurrentStreams()
98 server.enqueue(new MockResponse().setBody("GHI")); in settingsLimitsMaxConcurrentStreams()
/external/okhttp/okhttp-apache/src/test/java/com/squareup/okhttp/apache/
DOkApacheClientTest.java3 import com.squareup.okhttp.mockwebserver.MockResponse;
48 server.enqueue(new MockResponse().setBody("Hello, World!")); in success()
57 server.enqueue(new MockResponse().setResponseCode(302).addHeader("Location", "/foo")); in redirect()
58 server.enqueue(new MockResponse().setBody("Hello, Redirect!")); in redirect()
67 server.enqueue(new MockResponse().setResponseCode(422)); in sessionExpired()
75 server.enqueue(new MockResponse().addHeader("Foo", "Bar")); in headers()
76 server.enqueue(new MockResponse().addHeader("Foo", "Bar").addHeader("Foo", "Baz")); in headers()
93 server.enqueue(new MockResponse()); in postByteEntity()
106 server.enqueue(new MockResponse()); in postInputStreamEntity()
118 server.enqueue(new MockResponse()); in postEmptyEntity()
[all …]
/external/okhttp/okhttp-ws-tests/src/test/java/com/squareup/okhttp/ws/
DWebSocketCallTest.java24 import com.squareup.okhttp.mockwebserver.MockResponse;
55 server.enqueue(new MockResponse().withWebSocketUpgrade(serverListener)); in clientPingPong()
64 server.enqueue(new MockResponse().withWebSocketUpgrade(serverListener)); in clientMessage()
85 server.enqueue(new MockResponse().withWebSocketUpgrade(serverListener)); in serverMessage()
92 server.enqueue(new MockResponse()); in okButNotOk()
98 server.enqueue(new MockResponse().setStatus("HTTP/1.1 404 Not Found")); in notFound()
105 server.enqueue(new MockResponse() in missingConnectionHeader()
115 server.enqueue(new MockResponse() in wrongConnectionHeader()
126 server.enqueue(new MockResponse() in missingUpgradeHeader()
136 server.enqueue(new MockResponse() in wrongUpgradeHeader()
[all …]
/external/okhttp/samples/static-server/src/main/java/com/squareup/okhttp/sample/
DSampleServer.java5 import com.squareup.okhttp.mockwebserver.MockResponse;
40 @Override public MockResponse dispatch(RecordedRequest request) { in dispatch()
50 return new MockResponse() in dispatch()
55 return new MockResponse() in dispatch()
62 private MockResponse directoryToResponse(String basePath, File directory) { in directoryToResponse()
74 return new MockResponse() in directoryToResponse()
80 private MockResponse fileToResponse(String path, File file) throws IOException { in fileToResponse()
81 return new MockResponse() in fileToResponse()
/external/okhttp/okhttp-logging-interceptor/src/test/java/com/squareup/okhttp/logging/
DHttpLoggingInterceptorTest.java25 import com.squareup.okhttp.mockwebserver.MockResponse;
100 server.enqueue(new MockResponse()); in none()
110 server.enqueue(new MockResponse()); in basicGet()
127 server.enqueue(new MockResponse()); in basicPost()
144 server.enqueue(new MockResponse() in basicResponseBody()
164 server.enqueue(new MockResponse()); in headersGet()
196 server.enqueue(new MockResponse()); in headersPost()
233 server.enqueue(new MockResponse()); in headersPostNoContentType()
268 server.enqueue(new MockResponse()); in headersPostNoLength()
312 server.enqueue(new MockResponse() in headersResponseBody()
[all …]
/external/okhttp/mockwebserver/
DREADME.md37 server.enqueue(new MockResponse().setBody("hello, world!"));
38 server.enqueue(new MockResponse().setBody("sup, bra?"));
39 server.enqueue(new MockResponse().setBody("yo dog"));
82 #### MockResponse subsubsection
89 MockResponse response = new MockResponse()
95 MockResponse can be used to simulate a slow network. This is useful for
125 public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
128 return new MockResponse().setResponseCode(200);
130 return new MockResponse().setResponseCode(200).setBody("version=9");
132 …return new MockResponse().setResponseCode(200).setBody("{\\\"info\\\":{\\\"name\":\"Lucas Albuquer…
[all …]

12