Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 195 for Try (0.15 sec)

  1. okhttp-tls/src/test/java/okhttp3/tls/HeldCertificateTest.kt

          |lu/GJQZoU9lDrCPeUcQ28tzOWw==
          |-----END PRIVATE KEY-----
          |
          """.trimMargin()
        try {
          decode(certificatePem)
          fail<Any>()
        } catch (expected: IllegalArgumentException) {
          assertThat(expected.message).isEqualTo("string does not include a private key")
        }
        try {
          decode(pkcs8Pem)
          fail<Any>()
        } catch (expected: IllegalArgumentException) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 22.5K bytes
    - Viewed (0)
  2. samples/unixdomainsockets/src/main/java/okhttp3/unixdomainsockets/UnixDomainSocketFactory.java

        return new TunnelingUnixSocket(path, channel);
      }
    
      @Override public Socket createSocket(String host, int port) throws IOException {
        Socket result = createSocket();
    
        try {
          result.connect(new InetSocketAddress(host, port));
        } catch (IOException e) {
          result.close();
          throw e;
        }
        return result;
      }
    
      @Override public Socket createSocket(
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Dec 03 21:33:52 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  3. okhttp-java-net-cookiejar/src/main/kotlin/okhttp3/java/net/cookiejar/JavaNetCookieJar.kt

        }
        val multimap = mapOf("Set-Cookie" to cookieStrings)
        try {
          cookieHandler.put(url.toUri(), multimap)
        } catch (e: IOException) {
          Platform.get().log("Saving cookies failed for " + url.resolve("/...")!!, WARN, e)
        }
      }
    
      override fun loadForRequest(url: HttpUrl): List<Cookie> {
        val cookieHeaders =
          try {
            // The RI passes all headers. We don't have 'em, so we don't pass 'em!
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 04:10:43 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  4. samples/static-server/src/main/java/okhttp3/sample/SampleServer.java

        server.setDispatcher(this);
        server.start(port);
      }
    
      @Override public MockResponse dispatch(RecordedRequest request) {
        String path = request.getPath();
        try {
          if (!path.startsWith("/") || path.contains("..")) throw new FileNotFoundException();
    
          File file = new File(root + path);
          return file.isDirectory()
              ? directoryToResponse(path, file)
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Jan 02 02:50:44 GMT 2019
    - 4.7K bytes
    - Viewed (0)
  5. samples/slack/src/main/java/okhttp3/slack/SlackApi.java

            .addQueryParameter("redirect_uri", redirectUrl.toString())
            .build();
        Request request = new Request.Builder()
            .url(url)
            .build();
        Call call = httpClient.newCall(request);
        try (Response response = call.execute()) {
          JsonAdapter<OAuthSession> jsonAdapter = moshi.adapter(OAuthSession.class);
          return jsonAdapter.fromJson(response.body().source());
        }
      }
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Jul 06 19:30:55 GMT 2018
    - 4.4K bytes
    - Viewed (1)
  6. okhttp/src/main/kotlin/okhttp3/internal/connection/RealCall.kt

      }
    
      override fun isCanceled(): Boolean = canceled
    
      override fun execute(): Response {
        check(executed.compareAndSet(false, true)) { "Already Executed" }
    
        timeout.enter()
        callStart()
        try {
          client.dispatcher.executed(this)
          return getResponseWithInterceptorChain()
        } finally {
          client.dispatcher.finished(this)
        }
      }
    
      override fun enqueue(responseCallback: Callback) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 17.9K bytes
    - Viewed (2)
  7. okhttp/src/test/java/okhttp3/internal/http/ExternalHttp2Example.kt

            .build()
        val call =
          client.newCall(
            Request.Builder()
              .url("https://www.google.ca/")
              .build(),
          )
        val response = call.execute()
        try {
          println(response.code)
          println("PROTOCOL ${response.protocol}")
          var line: String?
          while (response.body.source().readUtf8Line().also { line = it } != null) {
            println(line)
          }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  8. samples/guide/src/main/java/okhttp3/recipes/ConfigureTimeouts.java

      }
    
      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("http://httpbin.org/delay/2") // This URL is served with a 2 second delay.
            .build();
    
        try (Response response = client.newCall(request).execute()) {
          System.out.println("Response completed: " + response);
        }
      }
    
      public static void main(String... args) throws Exception {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Sep 28 18:00:26 GMT 2019
    - 1.5K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/PostFile.java

        File file = new File("README.md");
    
        Request request = new Request.Builder()
            .url("https://api.github.com/markdown/raw")
            .post(RequestBody.create(file, MEDIA_TYPE_MARKDOWN))
            .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: Sat May 25 18:02:55 GMT 2019
    - 1.5K bytes
    - Viewed (0)
  10. regression-test/src/androidTest/java/okhttp/regression/IssueReproductionTest.java

      }
    
      private void sendRequest(OkHttpClient client, String url) throws IOException {
        Request request = new Request.Builder()
                .url(url)
                .build();
        try (Response response = client.newCall(request).execute()) {
          assertTrue(response.code() == 200 || response.code() == 404);
          assertEquals(Protocol.HTTP_2, response.protocol());
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jul 26 06:37:08 GMT 2021
    - 1.9K bytes
    - Viewed (0)
Back to top