Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 166 for okHttpClient (0.04 sec)

  1. samples/guide/src/main/java/okhttp3/guide/GetExample.java

     * limitations under the License.
     */
    package okhttp3.guide;
    
    import java.io.IOException;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.Response;
    
    public class GetExample {
      final OkHttpClient client = new OkHttpClient();
    
      String run(String url) throws IOException {
        Request request = new Request.Builder()
            .url(url)
            .build();
    
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Fri Apr 05 03:30:42 UTC 2024
    - 1.3K bytes
    - Viewed (0)
  2. samples/guide/src/main/java/okhttp3/recipes/WebSocketEcho.java

    package okhttp3.recipes;
    
    import java.util.concurrent.TimeUnit;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.Response;
    import okhttp3.WebSocket;
    import okhttp3.WebSocketListener;
    import okio.ByteString;
    
    public final class WebSocketEcho extends WebSocketListener {
      private void run() {
        OkHttpClient client = new OkHttpClient.Builder()
            .readTimeout(0,  TimeUnit.MILLISECONDS)
            .build();
    
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Thu Apr 04 11:40:21 UTC 2024
    - 1.6K bytes
    - Viewed (0)
  3. okhttp-zstd/src/test/java/okhttp3/zstd/ZstdTestMain.kt

     * limitations under the License.
     */
    package okhttp3.zstd
    
    import okhttp3.CompressionInterceptor
    import okhttp3.OkHttpClient
    import okhttp3.Request
    
    fun main() {
      val client =
        OkHttpClient
          .Builder()
          .addInterceptor(CompressionInterceptor(Zstd))
          .build()
    
      sendRequest("https://developers.facebook.com/docs/", client)
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Tue Jul 29 20:01:04 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  4. regression-test/src/androidTest/java/okhttp/regression/compare/OkHttpClientTest.java

     * https://square.github.io/okhttp/
     */
    @RunWith(AndroidJUnit4.class)
    public class OkHttpClientTest {
      @Test public void get() throws IOException {
        OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder()
            .url("https://google.com/robots.txt")
            .build();
        try (Response response = client.newCall(request).execute()) {
          assertEquals(200, response.code());
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Sat Nov 14 17:38:22 UTC 2020
    - 1.4K bytes
    - Viewed (0)
  5. module-tests/src/main/java/okhttp3/modules/OkHttpCaller.java

    import okhttp3.Call;
    import okhttp3.HttpUrl;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.logging.HttpLoggingInterceptor;
    import okhttp3.logging.LoggingEventListener;
    
    /**
     * Just checking compilation works
     */
    public class OkHttpCaller {
      public static Call callOkHttp(HttpUrl url) {
        OkHttpClient client = new OkHttpClient
          .Builder()
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Sun Sep 21 06:22:22 UTC 2025
    - 1.2K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/kt/ConfigureTimeouts.kt

     * limitations under the License.
     */
    package okhttp3.recipes.kt
    
    import java.util.concurrent.TimeUnit
    import okhttp3.OkHttpClient
    import okhttp3.Request
    
    class ConfigureTimeouts {
      private val client: OkHttpClient =
        OkHttpClient
          .Builder()
          .connectTimeout(5, TimeUnit.SECONDS)
          .writeTimeout(5, TimeUnit.SECONDS)
          .readTimeout(5, TimeUnit.SECONDS)
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  7. samples/guide/src/main/java/okhttp3/recipes/PostFile.java

    import java.io.IOException;
    import okhttp3.MediaType;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.RequestBody;
    import okhttp3.Response;
    
    public final class PostFile {
      public static final MediaType MEDIA_TYPE_MARKDOWN
          = MediaType.get("text/x-markdown; charset=utf-8");
    
      private final OkHttpClient client = new OkHttpClient();
    
      public void run() throws Exception {
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Sat May 25 18:02:55 UTC 2019
    - 1.5K bytes
    - Viewed (0)
  8. android-test/src/androidTest/java/okhttp/android/test/SingleAndroidTest.kt

    import okhttp3.ConnectionPool
    import okhttp3.OkHttpClient
    import okhttp3.Request
    import okhttp3.tls.internal.TlsUtil.localhost
    import org.junit.jupiter.api.Test
    
    /**
     * This single Junit 4 test is our Android test suite on API 21-25.
     */
    class SingleAndroidTest {
      private val handshakeCertificates = localhost()
    
      private var client: OkHttpClient =
        OkHttpClient
          .Builder()
          .sslSocketFactory(
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Fri Nov 21 12:33:41 UTC 2025
    - 2.1K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/LoggingInterceptors.java

    import java.io.IOException;
    import java.util.logging.Logger;
    import okhttp3.Interceptor;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.Response;
    
    public final class LoggingInterceptors {
      private static final Logger logger = Logger.getLogger(LoggingInterceptors.class.getName());
      private final OkHttpClient client = new OkHttpClient.Builder()
          .addInterceptor(new LoggingInterceptor())
          .build();
    
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Fri Jan 01 15:55:32 UTC 2016
    - 2K bytes
    - Viewed (0)
  10. android-test/src/androidTest/java/okhttp/android/test/StrictModeTest.kt

        applyStrictMode()
    
        // Not currently safe
        // See https://github.com/square/okhttp/pull/8248
        OkHttpClient()
    
        assertThat(violations).hasSize(1)
        assertThat(violations[0].message).isEqualTo("newSSLContext")
      }
    
      @Test
      fun testNewCall() {
        Platform.resetForTests()
    
        val client = OkHttpClient()
    
        applyStrictMode()
    
        // Safe on main
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Fri Nov 21 12:33:41 UTC 2025
    - 2.2K bytes
    - Viewed (0)
Back to top