Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 77 for MockResponse (0.14 sec)

  1. okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourceHttpTest.kt

            .build()
        server.enqueue(
          MockResponse.Builder()
            .headersDelay(500, TimeUnit.MILLISECONDS)
            .setHeader("content-type", "text/event-stream")
            .body("data: hey\n\n")
            .build(),
        )
        newEventSource()
        listener.assertFailure("timeout")
      }
    
      @Test
      fun retainsAccept() {
        server.enqueue(
          MockResponse.Builder()
            .body(
              """
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sun Jan 14 10:20:09 UTC 2024
    - 6.6K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/InsecureForHostTest.kt

    import assertk.assertions.isEqualTo
    import assertk.assertions.isNotNull
    import assertk.assertions.isNull
    import javax.net.ssl.SSLException
    import kotlin.test.assertFailsWith
    import mockwebserver3.MockResponse
    import mockwebserver3.MockWebServer
    import okhttp3.testing.PlatformRule
    import okhttp3.tls.HandshakeCertificates
    import okhttp3.tls.HeldCertificate
    import org.junit.jupiter.api.BeforeEach
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 4.2K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/ConnectionListenerTest.kt

        server!!.enqueue(MockResponse())
        assertSuccessfulEventOrder()
      }
    
      @Test
      @Throws(IOException::class)
      fun multipleDnsLookupsForSingleCall() {
        server!!.enqueue(
          MockResponse(
            code = 301,
            headers = headersOf("Location", "http://www.fakeurl:" + server!!.port),
          ),
        )
        server!!.enqueue(MockResponse())
        val dns = FakeDns()
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Jan 20 10:30:28 UTC 2024
    - 9.6K bytes
    - Viewed (0)
  4. mockwebserver-deprecated/src/main/kotlin/okhttp3/mockwebserver/Dispatcher.kt

     */
    package okhttp3.mockwebserver
    
    abstract class Dispatcher {
      @Throws(InterruptedException::class)
      abstract fun dispatch(request: RecordedRequest): MockResponse
    
      open fun peek(): MockResponse {
        return MockResponse().apply { this.socketPolicy = SocketPolicy.KEEP_OPEN }
      }
    
      open fun shutdown() {}
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sun Oct 18 12:55:43 UTC 2020
    - 909 bytes
    - Viewed (0)
  5. samples/static-server/src/main/java/okhttp3/sample/SampleServer.java

        }
        response.append("</body></html>");
    
        return new MockResponse()
            .setStatus("HTTP/1.1 200")
            .addHeader("content-type: text/html; charset=utf-8")
            .setBody(response.toString());
      }
    
      private MockResponse fileToResponse(String path, File file) throws IOException {
        return new MockResponse()
            .setStatus("HTTP/1.1 200")
            .setBody(fileToBytes(file))
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Wed Jan 02 02:50:44 UTC 2019
    - 4.7K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/FastFallbackTest.kt

            )
            .build()
    
        // Set up a same-connection retry.
        serverIpv4.enqueue(
          MockResponse(socketPolicy = ResetStreamAtStart(ErrorCode.REFUSED_STREAM.httpCode)),
        )
        serverIpv4.enqueue(
          MockResponse(body = "this was the 2nd request on IPv4"),
        )
        serverIpv6.enqueue(
          MockResponse(body = "unexpected call to IPv6"),
        )
    
        // Confirm the retry succeeds on the same connection.
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 10.3K bytes
    - Viewed (0)
  7. mockwebserver-deprecated/api/mockwebserver.api

    	public final fun setHeader (Ljava/lang/String;Ljava/lang/Object;)Lokhttp3/mockwebserver/MockResponse;
    	public final fun setHeaders (Lokhttp3/Headers;)Lokhttp3/mockwebserver/MockResponse;
    	public final fun setHeadersDelay (JLjava/util/concurrent/TimeUnit;)Lokhttp3/mockwebserver/MockResponse;
    	public final fun setHttp2ErrorCode (I)Lokhttp3/mockwebserver/MockResponse;
    	public final fun setResponseCode (I)Lokhttp3/mockwebserver/MockResponse;
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Jul 22 12:28:51 UTC 2023
    - 10.2K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/SocksProxyTest.kt

        this.server = server
        socksProxy.play()
      }
    
      @AfterEach
      fun tearDown() {
        socksProxy.shutdown()
      }
    
      @Test
      fun proxy() {
        server.enqueue(MockResponse.Builder().body("abc").build())
        server.enqueue(MockResponse.Builder().body("def").build())
        val client =
          clientTestRule.newClientBuilder()
            .proxy(socksProxy.proxy())
            .build()
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/URLConnectionTest.kt

       */
      @Test
      fun unauthorizedResponseHandling() {
        val mockResponse =
          MockResponse(
            code = HttpURLConnection.HTTP_UNAUTHORIZED,
            headers = headersOf("WWW-Authenticate", "challenge"),
            body = "Unauthorized",
          )
        server.enqueue(mockResponse)
        server.enqueue(mockResponse)
        server.enqueue(mockResponse)
        val response = getResponse(newRequest("/"))
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Jan 20 10:30:28 UTC 2024
    - 131.7K bytes
    - Viewed (0)
  10. okhttp/src/test/java/okhttp3/ConnectionCoalescingTest.kt

      @Test
      fun misdirectedRequestResponseCode() {
        server.enqueue(
          MockResponse.Builder()
            .body("seed connection")
            .build(),
        )
        server.enqueue(
          MockResponse.Builder()
            .code(421)
            .body("misdirected!")
            .build(),
        )
        server.enqueue(
          MockResponse.Builder()
            .body("after misdirect")
            .build(),
        )
    
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Jan 20 10:30:28 UTC 2024
    - 18.7K bytes
    - Viewed (0)
Back to top