Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 39 for tearDown (0.2 sec)

  1. samples/compare/src/test/kotlin/okhttp3/compare/ApacheHttpClientTest.kt

     *
     * Baseline test if we ned to validate OkHttp behaviour against other popular clients.
     */
    class ApacheHttpClientTest {
      private val httpClient = HttpClients.createDefault()
    
      @AfterEach fun tearDown() {
        httpClient.close()
      }
    
      @Test fun get(server: MockWebServer) {
        server.enqueue(
          MockResponse.Builder()
            .body("hello, Apache HttpClient 5.x")
            .build(),
        )
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.1K bytes
    - Viewed (0)
  2. mockwebserver/README.md

      // Shut down the server. Instances cannot be reused.
      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
    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)
  3. okhttp-tls/src/test/java/okhttp3/tls/HandshakeCertificatesTest.kt

      private var serverSocket: ServerSocket? = null
    
      @BeforeEach fun setUp() {
        executorService = Executors.newCachedThreadPool(threadFactory("HandshakeCertificatesTest"))
      }
    
      @AfterEach fun tearDown() {
        executorService.shutdown()
        serverSocket?.closeQuietly()
      }
    
      @Test fun clientAndServer() {
        platform.assumeNotConscrypt()
        platform.assumeNotBouncyCastle()
    
        val clientRoot =
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 7.1K bytes
    - Viewed (0)
  4. regression-test/src/androidTest/java/okhttp/regression/compare/AndroidHttpEngineTest.kt

              .addAllowedQuicHost("www.google.com")
              .build(),
          )
          .addQuicHint("google.com", 443, 443)
          .addQuicHint("www.google.com", 443, 443)
          .build()
    
      @After
      fun tearDown() {
        engine.shutdown()
        cacheDir.deleteRecursively()
      }
    
      @Test
      fun get() {
        val executor = Executors.newCachedThreadPool()
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Mar 24 13:19:43 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  5. okhttp/src/test/java/okhttp3/internal/ws/RealWebSocketTest.kt

        server.initWebSocket(random)
      }
    
      @AfterEach
      @Throws(Exception::class)
      fun tearDown() {
        client.listener.assertExhausted()
        server.listener.assertExhausted()
        server.source.close()
        client.source.close()
        taskFaker.runTasks()
        server.webSocket!!.tearDown()
        client.webSocket!!.tearDown()
        taskFaker.close()
      }
    
      @Test
      fun close() {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 01:59:58 GMT 2024
    - 18.5K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/SocksProxyTest.kt

      private val socksProxy = SocksProxy()
    
      @BeforeEach
      fun setUp(server: MockWebServer) {
        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 =
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.5K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/AddressTest.kt

    import org.junit.jupiter.api.Test
    
    class AddressTest {
      private val factory =
        TestValueFactory().apply {
          uriHost = "example.com"
          uriPort = 80
        }
    
      @AfterEach fun tearDown() {
        factory.close()
      }
    
      @Test fun equalsAndHashcode() {
        val a = factory.newAddress()
        val b = factory.newAddress()
        assertThat(b).isEqualTo(a)
        assertThat(b.hashCode()).isEqualTo(a.hashCode())
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/internal/concurrent/TaskRunnerRealBackendTest.kt

          }
        }
    
      private val backend = TaskRunner.RealBackend(threadFactory)
      private val taskRunner = TaskRunner(backend)
      private val queue = taskRunner.newQueue()
    
      @AfterEach fun tearDown() {
        backend.shutdown()
      }
    
      @Test fun test() {
        val t1 = System.nanoTime() / 1e6
    
        val delays = mutableListOf(TimeUnit.MILLISECONDS.toNanos(1000), -1L)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.5K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/internal/connection/RetryConnectionTest.kt

      @RegisterExtension
      val clientTestRule = OkHttpClientTestRule()
    
      private var client = clientTestRule.newClient()
    
      @AfterEach internal fun tearDown() {
        factory.close()
      }
    
      @Test fun nonRetryableIOException() {
        val exception = IOException("Non-handshake exception")
        assertThat(retryTlsHandshake(exception)).isFalse()
      }
    
    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)
  10. okhttp/src/test/java/okhttp3/internal/cache2/RelayTest.kt

      private val metadata: ByteString = "great metadata!".encodeUtf8()
      private lateinit var file: File
    
      @BeforeEach
      fun setUp() {
        file = File(tempDir, "test")
      }
    
      @AfterEach
      fun tearDown() {
        executor.shutdown()
      }
    
      @Test
      fun singleSource() {
        val upstream = Buffer()
        upstream.writeUtf8("abcdefghijklm")
        val relay = edit(file, upstream, metadata, 1024)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 8.1K bytes
    - Viewed (0)
Back to top