Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 101 for void (0.22 sec)

  1. docs/features/events.md

        printEvent("callEnd");
      }
    
      @Override public void dnsStart(Call call, String domainName) {
        printEvent("dnsStart");
      }
    
      @Override public void dnsEnd(Call call, String domainName, List<InetAddress> inetAddressList) {
        printEvent("dnsEnd");
      }
    
      ...
    }
    ```
    
    We make a couple calls:
    
    ```java
    Request request = new Request.Builder()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Feb 06 02:19:09 GMT 2022
    - 7.7K bytes
    - Viewed (0)
  2. samples/guide/src/main/java/okhttp3/recipes/PostStreaming.java

      private final OkHttpClient client = new OkHttpClient();
    
      public void run() throws Exception {
        RequestBody requestBody = new RequestBody() {
          @Override public MediaType contentType() {
            return MEDIA_TYPE_MARKDOWN;
          }
    
          @Override public void writeTo(BufferedSink sink) throws IOException {
            sink.writeUtf8("Numbers\n");
            sink.writeUtf8("-------\n");
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Fri Jul 06 03:18:15 GMT 2018
    - 2.1K bytes
    - Viewed (0)
  3. samples/guide/src/main/java/okhttp3/recipes/ConfigureTimeouts.java

            .build();
      }
    
      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 Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Sep 28 18:00:26 GMT 2019
    - 1.5K bytes
    - Viewed (0)
  4. samples/guide/src/main/java/okhttp3/recipes/PostFile.java

    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 {
        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))
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 1.5K bytes
    - Viewed (0)
  5. regression-test/src/androidTest/java/okhttp/regression/IssueReproductionTest.java

     * or Android SDKs.
     */
    @RunWith(AndroidJUnit4.class)
    public class IssueReproductionTest {
      @Test public void getFailsWithoutAdditionalCert() throws IOException {
        OkHttpClient client = new OkHttpClient();
    
        sendRequest(client, "https://google.com/robots.txt");
      }
    
      private void sendRequest(OkHttpClient client, String url) throws IOException {
        Request request = new Request.Builder()
                .url(url)
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jul 26 06:37:08 GMT 2021
    - 1.9K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/HttpsServer.java

    import okhttp3.tls.HandshakeCertificates;
    import okhttp3.tls.HeldCertificate;
    
    /**
     * Create an HTTPS server with a self-signed certificate that OkHttp trusts.
     */
    public class HttpsServer {
      public void run() throws Exception {
        HeldCertificate localhostCertificate = new HeldCertificate.Builder()
            .addSubjectAlternativeName("localhost")
            .build();
    
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 02 14:04:37 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  7. samples/static-server/src/main/java/okhttp3/sample/SampleServer.java

      private final int port;
    
      public SampleServer(SSLContext sslContext, String root, int port) {
        this.sslContext = sslContext;
        this.root = root;
        this.port = port;
      }
    
      public void run() throws IOException {
        MockWebServer server = new MockWebServer();
        server.useHttps(sslContext.getSocketFactory(), false);
        server.setDispatcher(this);
        server.start(port);
      }
    
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Wed Jan 02 02:50:44 GMT 2019
    - 4.7K bytes
    - Viewed (0)
  8. mockwebserver/README.md

    [Mockito](https://github.com/mockito/mockito):
    
    1. Script the mocks.
    2. Run application code.
    3. Verify that the expected requests were made.
    
    Here's a complete example:
    
    ```java
    public void test() throws Exception {
      // Create a MockWebServer. These are lean enough that you can create a new
      // instance for every unit test.
      MockWebServer server = new MockWebServer();
    
      // Schedule some responses.
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Dec 17 15:34:10 GMT 2023
    - 5K bytes
    - Viewed (1)
  9. okhttp-tls/src/main/kotlin/okhttp3/tls/internal/der/Certificate.kt

        return result
      }
    }
    
    internal data class AlgorithmIdentifier(
      /** An OID string like "1.2.840.113549.1.1.11" for sha256WithRSAEncryption. */
      val algorithm: String,
      /** Parameters of a type implied by [algorithm]. */
      val parameters: Any?,
    )
    
    internal data class AttributeTypeAndValue(
      /** An OID string like "2.5.4.11" for organizationalUnitName. */
      val type: String,
      val value: Any?,
    )
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  10. samples/guide/src/main/java/okhttp3/recipes/PrintEventsNonConcurrent.java

        }
    
        @Override public void callStart(Call call) {
          printEvent("callStart");
        }
    
        @Override public void proxySelectStart(Call call, HttpUrl url) {
          printEvent("proxySelectStart");
        }
    
        @Override public void proxySelectEnd(Call call, HttpUrl url, List<Proxy> proxies) {
          printEvent("proxySelectEnd");
        }
    
        @Override public void dnsStart(Call call, String domainName) {
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Feb 16 23:20:49 GMT 2020
    - 5.3K bytes
    - Viewed (0)
Back to top