Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 175 for execute (0.14 sec)

  1. samples/guide/src/main/java/okhttp3/recipes/HttpsServer.java

            .build();
    
        Call call = client.newCall(new Request.Builder()
            .url(server.url("/"))
            .build());
        Response response = call.execute();
        System.out.println(response.handshake().tlsVersion());
      }
    
      public static void main(String... args) throws Exception {
        new HttpsServer().run();
      }
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 02 14:04:37 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  2. samples/guide/src/main/java/okhttp3/recipes/kt/Authenticate.kt

            },
          )
          .build()
    
      fun run() {
        val request =
          Request.Builder()
            .url("http://publicobject.com/secrets/hellosecret.txt")
            .build()
    
        client.newCall(request).execute().use { response ->
          if (!response.isSuccessful) throw IOException("Unexpected code $response")
    
          println(response.body.string())
        }
      }
    }
    
    fun main() {
      Authenticate().run()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  3. okhttp/src/main/kotlin/okhttp3/Interceptor.kt

     * when responses are of an unexpected type or cannot be decoded.
     *
     * Other exception types cancel the current call:
     *
     *  * For synchronous calls made with [Call.execute], the exception is propagated to the caller.
     *
     *  * For asynchronous calls made with [Call.enqueue], an [IOException] is propagated to the caller
    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)
  4. samples/guide/src/main/java/okhttp3/recipes/PostStreaming.java

          }
        };
    
        Request request = new Request.Builder()
            .url("https://api.github.com/markdown/raw")
            .post(requestBody)
            .build();
    
        try (Response response = client.newCall(request).execute()) {
          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          System.out.println(response.body().string());
        }
      }
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Jul 06 03:18:15 GMT 2018
    - 2.1K bytes
    - Viewed (0)
  5. container-tests/src/test/java/okhttp3/containers/SocksProxyTest.kt

              .build()
    
          val response =
            client.newCall(
              Request("http://mockserver:1080/person?name=peter".toHttpUrl()),
            ).execute()
    
          assertThat(response.body.string()).contains("Peter the person")
        }
      }
    
      companion object {
        val SOCKS5_PROXY: DockerImageName =
          DockerImageName
            .parse("serjs/go-socks5-proxy")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 2.6K bytes
    - Viewed (0)
  6. samples/compare/src/test/kotlin/okhttp3/compare/ApacheHttpClientTest.kt

          MockResponse.Builder()
            .body("hello, Apache HttpClient 5.x")
            .build(),
        )
    
        val request = HttpGet(server.url("/").toUri())
        request.addHeader("Accept", "text/plain")
    
        httpClient.execute(request).use { response ->
          assertThat(response.code).isEqualTo(200)
          assertThat(EntityUtils.toString(response.entity)).isEqualTo("hello, Apache HttpClient 5.x")
        }
    
        val recorded = server.takeRequest()
    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)
  7. regression-test/src/androidTest/java/okhttp/regression/compare/ApacheHttpClientHttp2Test.kt

        val client = HttpAsyncClients.createHttp2Default()
    
        client.use { client ->
          client.start()
          val request = SimpleHttpRequests.get("https://google.com/robots.txt")
          val response = client.execute(request, LoggingCallback).get()
    
          println("Protocol ${response.version}")
          println("Response ${response.code}")
          println("${response.body.bodyText.substring(0, 20)}...")
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.6K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/internal/http2/MockHttp2Peer.kt

        check(serverSocket == null)
        serverSocket = ServerSocket()
        serverSocket!!.reuseAddress = false
        serverSocket!!.bind(InetSocketAddress("localhost", 0), 1)
        port = serverSocket!!.localPort
        executor.execute {
          try {
            readAndWriteFrames()
          } catch (e: IOException) {
            ******@****.***uietly()
            logger.info("${this@MockHttp2Peer} done: ${e.message}")
          }
        }
      }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 8.7K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/URLConnectionTest.kt

        val call1 = client.newCall(newRequest("/"))
        val response1 = call1.execute()
        val in1 = response1.body.byteStream()
        assertThat(readAscii(in1, 5)).isEqualTo("ABCDE")
        in1.close()
        call1.cancel()
        val call2 = client.newCall(newRequest("/"))
        val response2 = call2.execute()
        val in2 = response2.body.byteStream()
        assertThat(readAscii(in2, 5)).isEqualTo("LMNOP")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 131.7K bytes
    - Viewed (0)
  10. okhttp/src/test/java/okhttp3/CallTest.kt

            .header("User-Agent", "SyncApiTest")
            .build()
        val call = client.newCall(request)
        val response = call.execute()
        response.body.close()
        assertFailsWith<IllegalStateException> {
          call.execute()
        }.also { expected ->
          assertThat(expected.message).isEqualTo("Already Executed")
        }
        assertFailsWith<IllegalStateException> {
          call.enqueue(callback)
        }.also { expected ->
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 142.5K bytes
    - Viewed (0)
Back to top