Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 43 for mock (0.15 sec)

  1. mockwebserver/src/main/kotlin/mockwebserver3/Dispatcher.kt

     * limitations under the License.
     */
    package mockwebserver3
    
    import mockwebserver3.SocketPolicy.KeepOpen
    import okhttp3.ExperimentalOkHttpApi
    
    /** Handler for mock server requests. */
    @ExperimentalOkHttpApi
    abstract class Dispatcher {
      /**
       * Returns a response to satisfy `request`. This method may block (for instance, to wait on
       * a CountdownLatch).
       */
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Tue Jan 23 14:31:42 GMT 2024
    - 1.7K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/internal/platform/Jdk9PlatformTest.kt

        platform.assumeJdk9()
        val applicationProtocolUnsupported =
          object : DelegatingSSLSocket(null) {
            override fun getApplicationProtocol(): String {
              throw UnsupportedOperationException("Mock exception")
            }
          }
        assertThat(Jdk9Platform().getSelectedProtocol(applicationProtocolUnsupported)).isNull()
      }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.1K bytes
    - Viewed (0)
  3. container-tests/src/test/java/okhttp3/containers/BasicLoomTest.kt

    import org.testcontainers.junit.jupiter.Testcontainers
    
    @Testcontainers
    @Isolated
    class BasicLoomTest {
      @JvmField
      @RegisterExtension
      val platform = PlatformRule()
    
      // Use mock server so we are strictly testing OkHttp client only in this test.
      // We should test MockWebServer later.
      @Container
      val mockServer: MockServerContainer = MockServerContainer(MOCKSERVER_IMAGE)
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 06 11:15:46 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  4. mockwebserver/src/test/java/mockwebserver3/MockWebServerTest.kt

      }
    
      @Test
      fun setResponseMockReason() {
        val reasons =
          arrayOf<String?>(
            "Mock Response",
            "Informational",
            "OK",
            "Redirection",
            "Client Error",
            "Server Error",
            "Mock Response",
          )
        for (i in 0..599) {
          val builder = MockResponse.Builder().code(i)
          val expectedReason = reasons[i / 100]
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 23.5K bytes
    - Viewed (0)
  5. docs/changelogs/upgrading_to_okhttp_4.md

    in OkHttp 3.x and are final in 4.x. These were made non-final for use with mocking frameworks like
    [Mockito][mockito]. We believe subtyping `OkHttpClient` is the wrong way to test with OkHttp. If
    you must, mock `Call.Factory` which is the interface that `OkHttpClient` implements.
    
    #### Internal API changes
    
    The `okhttp3.internal` package is not a published API and we change it frequently without warning.
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Feb 06 16:58:16 GMT 2022
    - 10.9K bytes
    - Viewed (0)
  6. okhttp/src/main/kotlin/okhttp3/internal/connection/Locks.kt

        return lock.withLock(action)
      }
    
      inline fun <T> RealConnection.withLock(action: () -> T): T {
        contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) }
        return lock.withLock(action)
      }
    
      inline fun <T> RealCall.withLock(action: () -> T): T {
        contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) }
        return lock.withLock(action)
      }
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 2.1K bytes
    - Viewed (0)
  7. okhttp/src/main/kotlin/okhttp3/internal/http2/Http2Stream.kt

      outFinished: Boolean,
      inFinished: Boolean,
      headers: Headers?,
    ) {
      internal val lock: ReentrantLock = ReentrantLock()
      val condition: Condition = lock.newCondition()
    
      // Internal state is guarded by [lock]. No long-running or potentially blocking operations are
      // performed while the lock is held.
    
      /** The bytes consumed and acknowledged by the stream. */
      val readBytes: WindowCounter = WindowCounter(id)
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 23.2K bytes
    - Viewed (1)
  8. okhttp/src/main/kotlin/okhttp3/internal/connection/RealConnectionPool.kt

        queue.schedule(
          object : Task("$okHttpName ConnectionPool connection opener") {
            override fun runOnce(): Long = openConnections(this@scheduleOpener)
          },
        )
      }
    
      /**
       * Holding the lock of the connection being added or removed when mutating this, and check its
       * [RealConnection.noNewExchanges] property. This defends against races where a connection is
       * simultaneously adopted and removed.
       */
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 16.2K bytes
    - Viewed (0)
  9. okhttp/src/main/kotlin/okhttp3/internal/cache/DiskLruCache.kt

              synchronized(this@DiskLruCache) {
                detach()
              }
            }
          }
        }
    
        /**
         * Commits this edit so it is visible to readers. This releases the edit lock so another edit
         * may be started on the same key.
         */
        @Throws(IOException::class)
        fun commit() {
          synchronized(this@DiskLruCache) {
            check(!done)
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 34.7K bytes
    - Viewed (0)
  10. mockwebserver/README.md

      server.shutdown();
    }
    ```
    
    Your unit tests might move the `server` into a field so you can shut it down
    from your test's `tearDown()`.
    
    ### API
    
    #### MockResponse
    
    Mock responses default to an empty response body and a `200` status code.
    You can set a custom body with a string, input stream or byte array. Also
    add headers with a fluent builder API.
    
    ```java
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Dec 17 15:34:10 GMT 2023
    - 5K bytes
    - Viewed (1)
Back to top