Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 110 for mockWebServer (1.5 sec)

  1. mockwebserver-junit5/src/main/kotlin/mockwebserver3/junit5/StartStop.kt

    import org.junit.jupiter.api.extension.ExtendWith
    
    /**
     * Runs MockWebServer for the duration of a test method or test class.
     *
     * In Java JUnit 5 tests (ie. tests annotated `@org.junit.jupiter.api.Test`), use this by defining a
     * field with the `@StartStop` annotation:
     *
     * ```java
     * @StartStop public final MockWebServer server = new MockWebServer();
     * ```
     *
     * Or for Kotlin:
     *
     * ```kotlin
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Thu Jun 19 11:44:16 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  2. samples/guide/src/main/java/okhttp3/recipes/kt/DevServer.kt

    import okhttp3.OkHttpClient
    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(
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 1.9K bytes
    - Viewed (0)
  3. settings.gradle.kts

    }
    
    include(":mockwebserver")
    project(":mockwebserver").name = "mockwebserver3"
    include(":mockwebserver-deprecated")
    project(":mockwebserver-deprecated").name = "mockwebserver"
    include(":mockwebserver-junit4")
    project(":mockwebserver-junit4").name = "mockwebserver3-junit4"
    include(":mockwebserver-junit5")
    project(":mockwebserver-junit5").name = "mockwebserver3-junit5"
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Jul 19 13:41:00 UTC 2025
    - 1.9K bytes
    - Viewed (0)
  4. mockwebserver-junit4/README.md

    MockWebServer for JUnit 4
    =========================
    
    This module integrates mockwebserver3.MockWebServer with JUnit 4.
    
    To use, first add this library as a test dependency:
    
    ```
    testImplementation("com.squareup.okhttp3:mockwebserver3-junit4:5.1.0")
    ```
    
    Then in tests annotated `@org.junit.Test`, you may declare a field with the `@Rule` annotation:
    
    ```
    @Rule public final MockWebServerRule serverRule = new MockWebServerRule();
    ```
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jul 07 19:32:33 UTC 2025
    - 706 bytes
    - Viewed (0)
  5. okhttp/src/jvmTest/kotlin/okhttp3/internal/http/ThreadInterruptTest.kt

    import okhttp3.OkHttpClient
    import okhttp3.OkHttpClientTestRule
    import okhttp3.Request
    import okhttp3.RequestBody
    import okhttp3.Response
    import okhttp3.mockwebserver.MockResponse
    import okhttp3.mockwebserver.MockWebServer
    import okhttp3.mockwebserver.SocketPolicy
    import okhttp3.testing.PlatformRule
    import okio.Buffer
    import okio.BufferedSink
    import org.junit.jupiter.api.AfterEach
    import org.junit.jupiter.api.BeforeEach
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 11:30:11 UTC 2025
    - 6.1K bytes
    - Viewed (0)
  6. samples/static-server/src/main/java/okhttp3/sample/SampleServer.java

    import javax.net.ssl.KeyManagerFactory;
    import javax.net.ssl.SSLContext;
    import javax.net.ssl.TrustManagerFactory;
    import okhttp3.mockwebserver.Dispatcher;
    import okhttp3.mockwebserver.MockResponse;
    import okhttp3.mockwebserver.MockWebServer;
    import okhttp3.mockwebserver.RecordedRequest;
    import okio.Buffer;
    import okio.Okio;
    
    public class SampleServer extends Dispatcher {
      private final SSLContext sslContext;
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Jan 02 02:50:44 UTC 2019
    - 4.7K bytes
    - Viewed (0)
  7. samples/guide/src/main/java/okhttp3/recipes/HttpsServer.java

     */
    package okhttp3.recipes;
    
    import java.net.InetAddress;
    import okhttp3.Call;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.Response;
    import okhttp3.mockwebserver.MockResponse;
    import okhttp3.mockwebserver.MockWebServer;
    import okhttp3.tls.HandshakeCertificates;
    import okhttp3.tls.HeldCertificate;
    
    /**
     * Create an HTTPS server with a self-signed certificate that OkHttp trusts.
     */
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jan 02 14:04:37 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  8. CHANGELOG.md

        Put this annotation on a `MockWebServer` property and the extension will start it before your
        test executes and stop it after it completes. No further configuration is required.
    
        ```kotlin
        @StartStop val server = MockWebServer()
        ```
    
     *  Breaking: Don't automatically start `MockWebServer` after calls to accessors like `port`. Now
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jul 07 19:32:33 UTC 2025
    - 31.6K bytes
    - Viewed (1)
  9. mockwebserver-junit5/src/main/kotlin/mockwebserver3/junit5/internal/StartStopExtension.kt

     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    package mockwebserver3.junit5.internal
    
    import java.lang.reflect.Modifier
    import mockwebserver3.MockWebServer
    import mockwebserver3.junit5.StartStop
    import org.junit.jupiter.api.extension.BeforeAllCallback
    import org.junit.jupiter.api.extension.BeforeEachCallback
    import org.junit.jupiter.api.extension.ExtensionContext
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Thu Jun 19 11:44:16 UTC 2025
    - 2.3K bytes
    - Viewed (0)
  10. mockwebserver-junit4/src/main/kotlin/mockwebserver3/junit4/MockWebServerRule.kt

     * limitations under the License.
     */
    package mockwebserver3.junit4
    
    import java.io.IOException
    import mockwebserver3.MockWebServer
    import org.junit.rules.ExternalResource
    
    /**
     * Runs MockWebServer for the duration of a single test method.
     *
     * In Java JUnit 4 tests (ie. tests annotated `@org.junit.Test`), use this by defining a field with
     * the `@Rule` annotation:
     *
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jun 16 22:36:18 UTC 2025
    - 1.4K bytes
    - Viewed (0)
Back to top