Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for simulate (0.21 sec)

  1. mockwebserver/README.md

    ```java
    MockResponse response = new MockResponse()
        .addHeader("Content-Type", "application/json; charset=utf-8")
        .addHeader("Cache-Control", "no-cache")
        .setBody("{}");
    ```
    
    MockResponse can be used to simulate a slow network. This is useful for
    testing timeouts and interactive testing.
    
    ```java
    response.throttleBody(1024, 1, TimeUnit.SECONDS);
    ```
    
    
    #### RecordedRequest
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Dec 17 15:34:10 GMT 2023
    - 5K bytes
    - Viewed (1)
  2. mockwebserver/src/main/kotlin/mockwebserver3/SocketPolicy.kt

      /**
       * Request immediate close of connection without even reading the request. Use to simulate buggy
       * SSL servers closing connections in response to unrecognized TLS extensions.
       */
      object DisconnectAtStart : SocketPolicy
    
      /**
       * Close connection after reading the request but before writing the response. Use this to
       * simulate late connection pool failures.
       */
      object DisconnectAfterRequest : SocketPolicy
    
      /**
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Tue Jan 23 14:31:42 GMT 2024
    - 4.6K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/ConnectionCoalescingTest.kt

        // Simulate a stale connection in the pool.
        connection.get()!!.socket().close()
        val sanUrl = url.newBuilder().host("san.com").build()
        assert200Http2Response(execute(sanUrl), "san.com")
        assertThat(client.connectionPool.connectionCount()).isEqualTo(1)
      }
    
      /**
       * This is an extraordinary test case. Here's what it's trying to simulate.
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 18.7K bytes
    - Viewed (0)
  4. mockwebserver/src/main/kotlin/mockwebserver3/MockResponse.kt

          }
    
        /**
         * Throttles the request reader and response writer to sleep for the given period after each
         * series of [bytesPerPeriod] bytes are transferred. Use this to simulate network behavior.
         */
        fun throttleBody(
          bytesPerPeriod: Long,
          period: Long,
          unit: TimeUnit,
        ) = apply {
          throttleBytesPerPeriod = bytesPerPeriod
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Tue Jan 23 14:31:42 GMT 2024
    - 13.3K bytes
    - Viewed (1)
  5. okhttp-testing-support/src/main/kotlin/okhttp3/internal/concurrent/TaskFaker.kt

          val sleepUntil = nanoTime + durationNanos
          yieldUntil { nanoTime >= sleepUntil }
        }
      }
    
      /**
       * Artificially stall until manually resumed by the test thread with [runTasks]. Use this to
       * simulate races in tasks that doesn't have a deterministic sequence.
       */
      fun yield() {
        taskRunner.assertThreadDoesntHoldLock()
        taskRunner.lock.withLock {
          yieldUntil()
        }
      }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 29 00:33:04 GMT 2024
    - 12.6K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/internal/http2/HpackTest.kt

        // Once a header field is decoded and added to the reconstructed header
        // list, it cannot be removed from it. Hence, foo is here.
        assertThat(hpackReader!!.getAndResetHeaderList()).isEqualTo(headerBlock)
    
        // Simulate receiving a small dynamic table size update, that implies eviction.
        bytesIn.writeByte(0x3F) // Dynamic table size update (size = 55).
        bytesIn.writeByte(0x18)
        hpackReader!!.readHeaders()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 38.2K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/internal/cache/DiskLruCacheTest.kt

        // incomplete.
        val creator = cache.edit("k1")!!
        creator.newSink(0).buffer().use {
          it.writeUtf8("Hello")
        }
    
        // Simulate a severe Filesystem failure on the first initialization.
        filesystem.setFaultyDelete(cacheDir / "k1.0.tmp", true)
        filesystem.setFaultyDelete(cacheDir, true)
        cache =
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 15 14:55:09 GMT 2024
    - 75.8K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/internal/connection/RetryConnectionTest.kt

    class RetryConnectionTest {
      private val factory = TestValueFactory()
      private val handshakeCertificates = localhost()
      private val retryableException = SSLHandshakeException("Simulated handshake exception")
    
      @RegisterExtension
      val clientTestRule = OkHttpClientTestRule()
    
      private var client = clientTestRule.newClient()
    
      @AfterEach internal fun tearDown() {
        factory.close()
      }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.3K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/internal/http2/HttpOverHttp2Test.kt

          Thread.sleep(2000L)
        }
        if (connection.isHealthy(false)) {
          throw TimeoutException("connection didn't shutdown within timeout")
        }
      }
    
      /**
       * This simulates a race condition where we receive a healthy HTTP/2 connection and just prior to
       * writing our request, we get a GOAWAY frame from the server.
       */
      @ParameterizedTest
      @ArgumentsSource(ProtocolParamProvider::class)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 75.3K bytes
    - Viewed (0)
Back to top