- Sort Score
- Result 10 results
- Languages All
Results 31 - 40 of 77 for MockResponse (0.14 sec)
-
okhttp/src/test/java/okhttp3/RouteFailureTest.kt
client = client.newBuilder().proxySelector(proxySelector).build() val request = Request(server1.url("/")) server1.enqueue(MockResponse(200)) server2.enqueue(MockResponse(200)) server2.enqueue(MockResponse(200)) println("\n\nRequest to ${server1.inetSocketAddress}") executeSynchronously(request) .assertSuccessful() .assertCode(200)
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Tue May 14 17:48:07 UTC 2024 - 11.9K bytes - Viewed (0) -
mockwebserver/src/test/java/mockwebserver3/MockWebServerTest.kt
@Disabled("Not actually failing where expected") @Test fun disconnectAtStart() { server.enqueue( MockResponse.Builder() .socketPolicy(DisconnectAtStart) .build(), ) server.enqueue(MockResponse()) // The jdk's HttpUrlConnection is a bastard. server.enqueue(MockResponse()) try { server.url("/a").toUrl().openConnection().getInputStream() fail<Unit>()
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 23.5K bytes - Viewed (0) -
mockwebserver/README.md
// instance for every unit test. MockWebServer server = new MockWebServer(); // Schedule some responses. server.enqueue(new MockResponse().setBody("hello, world!")); server.enqueue(new MockResponse().setBody("sup, bra?")); server.enqueue(new MockResponse().setBody("yo dog")); // Start the server. server.start(); // Ask the server for its URL. You'll need this to make HTTP requests.
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sun Dec 17 15:34:10 UTC 2023 - 5K bytes - Viewed (0) -
okhttp-coroutines/src/test/kotlin/okhttp3/coroutines/ExecuteAsyncTest.kt
runTest { server.enqueue(MockResponse(body = "abc")) val call = client.newCall(request) call.executeAsync().use { withContext(Dispatchers.IO) { assertThat(it.body.string()).isEqualTo("abc") } } } } @Test fun timeoutCall() { runTest { server.enqueue( MockResponse.Builder() .bodyDelay(5, TimeUnit.SECONDS)
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Thu Apr 18 01:24:38 UTC 2024 - 5.4K bytes - Viewed (0) -
mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.kt
@Disabled("Not actually failing where expected") @Test fun disconnectAtStart() { server.enqueue( MockResponse() .setSocketPolicy(SocketPolicy.DISCONNECT_AT_START), ) server.enqueue(MockResponse()) // The jdk's HttpUrlConnection is a bastard. server.enqueue(MockResponse()) try { server.url("/a").toUrl().openConnection().getInputStream() fail<Any>()
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 21.9K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/kt/DevServer.kt
import okhttp3.Request import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer import okhttp3.tls.HandshakeCertificates import okhttp3.tls.internal.TlsUtil class DevServer { val handshakeCertificates = TlsUtil.localhost() val server = MockWebServer().apply { useHttps(handshakeCertificates.sslSocketFactory(), false) enqueue( MockResponse() .setResponseCode(HTTP_MOVED_TEMP)
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 1.9K bytes - Viewed (0) -
okhttp/src/test/java/okhttp3/LoomTest.kt
package okhttp3 import assertk.assertThat import assertk.assertions.isEqualTo import assertk.assertions.isTrue import java.util.concurrent.ExecutorService import java.util.concurrent.Executors import mockwebserver3.MockResponse import mockwebserver3.MockWebServer import okhttp3.testing.PlatformRule import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 2K bytes - Viewed (0) -
native-image-tests/src/main/kotlin/okhttp3/SampleTest.kt
* See the License for the specific language governing permissions and * limitations under the License. */ package okhttp3 import assertk.assertThat import assertk.assertions.isEqualTo import mockwebserver3.MockResponse import mockwebserver3.MockWebServer import okhttp3.HttpUrl.Companion.toHttpUrl import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension import org.junit.jupiter.params.ParameterizedTest
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 1.8K bytes - Viewed (0) -
android-test/src/androidTest/java/okhttp/android/test/OkHttpTest.kt
val eventListener = RecordingEventListener() enableTls() client = client.newBuilder().eventListenerFactory(clientTestRule.wrap(eventListener)).build() server.enqueue(MockResponse(body = "abc1")) server.enqueue(MockResponse(body = "abc2")) val request = Request.Builder().url(server.url("/")).build() client.newCall(request).execute().use { response -> assertEquals(200, response.code) }
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sat Jan 20 10:30:28 UTC 2024 - 27K bytes - Viewed (0) -
mockwebserver/src/main/kotlin/mockwebserver3/Dispatcher.kt
* request bodies. */ open fun peek(): MockResponse { return MockResponse(socketPolicy = KeepOpen) } /** * Release any resources held by this dispatcher. Any requests that are currently being dispatched * should return immediately. Responses returned after shutdown will not be transmitted: their * socket connections have already been closed.
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Tue Jan 23 14:31:42 UTC 2024 - 1.7K bytes - Viewed (0)