Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for EventListener (0.2 sec)

  1. okhttp-testing-support/src/main/kotlin/okhttp3/EventListenerRelay.kt

          .apply {
            listeners += ::onEvent
          }
    
      val eventListener: EventListener
        get() = eventListenerAdapter
    
      var eventCount = 0
    
      private fun onEvent(callEvent: CallEvent) {
        if (eventCount++ == 0) {
          eventRecorder.logEvent(callEvent)
          val next = EventListenerRelay(call, eventRecorder)
          call.addEventListener(next.eventListener)
        }
      }
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Wed Nov 05 18:28:35 UTC 2025
    - 1.5K bytes
    - Viewed (0)
  2. okhttp-logging-interceptor/src/main/kotlin/okhttp3/logging/LoggingEventListener.kt

    import java.util.concurrent.TimeUnit
    import okhttp3.Call
    import okhttp3.Connection
    import okhttp3.Dispatcher
    import okhttp3.EventListener
    import okhttp3.Handshake
    import okhttp3.HttpUrl
    import okhttp3.OkHttpClient
    import okhttp3.Protocol
    import okhttp3.Request
    import okhttp3.Response
    
    /**
     * An OkHttp EventListener, which logs call events. Can be applied as an
     * [event listener factory][OkHttpClient.eventListenerFactory].
     *
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Mon Oct 06 13:40:20 UTC 2025
    - 5.8K bytes
    - Viewed (0)
  3. okhttp/src/jvmTest/kotlin/okhttp3/internal/http/SocketFailureTest.kt

      @StartStop
      private val server = MockWebServer()
    
      private var client =
        clientTestRule
          .newClientBuilder()
          .eventListener(listener)
          .build()
    
      class SocketClosingEventListener : EventListener() {
        var shouldClose: Boolean = false
        var lastSocket: Socket? = null
    
        override fun connectionAcquired(
          call: Call,
          connection: Connection,
        ) {
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Tue Jul 29 21:11:09 UTC 2025
    - 3K bytes
    - Viewed (0)
  4. android-test/src/androidTest/java/okhttp/android/test/alpn/AlpnOverrideTest.kt

              listOf(
                ConnectionSpec
                  .Builder(ConnectionSpec.MODERN_TLS)
                  .supportsTlsExtensions(false)
                  .build(),
              ),
            ).eventListener(
              object : EventListener() {
                override fun connectionAcquired(
                  call: Call,
                  connection: Connection,
                ) {
                  val sslSocket = connection.socket() as SSLSocket
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 2.8K bytes
    - Viewed (0)
  5. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/connection/RouteSelector.kt

          if (proxiesOrNull.isNullOrEmpty()) return immutableListOf(Proxy.NO_PROXY)
    
          return proxiesOrNull.toImmutableList()
        }
    
        call.eventListener.proxySelectStart(call, url)
        proxies = selectProxies()
        nextProxyIndex = 0
        call.eventListener.proxySelectEnd(call, url, proxies)
      }
    
      /** Returns true if there's another proxy to try. */
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Wed Oct 08 03:50:05 UTC 2025
    - 7.3K bytes
    - Viewed (2)
  6. samples/guide/src/main/java/okhttp3/recipes/PrintEventsNonConcurrent.java

    import java.io.IOException;
    import java.net.InetAddress;
    import java.net.InetSocketAddress;
    import java.net.Proxy;
    import java.util.List;
    import okhttp3.Call;
    import okhttp3.Connection;
    import okhttp3.EventListener;
    import okhttp3.Handshake;
    import okhttp3.HttpUrl;
    import okhttp3.OkHttpClient;
    import okhttp3.Protocol;
    import okhttp3.Request;
    import okhttp3.Response;
    
    /**
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Sun Feb 16 23:20:49 UTC 2020
    - 5.3K bytes
    - Viewed (0)
  7. docs/features/events.md

     * The performance of these calls on the underlying network. If the network’s performance isn’t sufficient, you need to either improve the network or use less of it.
    
    ### EventListener
    
    Subclass [EventListener](https://square.github.io/okhttp/3.x/okhttp/okhttp3/EventListener.html) and override methods for the events you are interested in. In a successful HTTP call with no redirects or retries the sequence of events is described by this flow.
    
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Sun Feb 06 02:19:09 UTC 2022
    - 7.7K bytes
    - Viewed (0)
  8. okhttp-testing-support/src/main/kotlin/okhttp3/EventListenerAdapter.kt

    import okhttp3.CallEvent.SecureConnectEnd
    import okhttp3.CallEvent.SecureConnectStart
    
    /**
     * This accepts events as function calls on [EventListener], and publishes them as subtypes of
     * [CallEvent].
     */
    class EventListenerAdapter : EventListener() {
      var listeners = listOf<(CallEvent) -> Unit>()
    
      private fun onEvent(listener: CallEvent) {
        for (function in listeners) {
          function(listener)
        }
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Tue Nov 04 19:13:52 UTC 2025
    - 7.1K bytes
    - Viewed (0)
  9. okhttp-testing-support/src/main/kotlin/okhttp3/EventRecorder.kt

       */
      private val enforceOrder: Boolean = true,
    ) {
      private val eventListenerAdapter =
        EventListenerAdapter()
          .apply {
            listeners += ::logEvent
          }
    
      val eventListener: EventListener
        get() = eventListenerAdapter
    
      /** Events that haven't yet been removed. */
      val eventSequence: Deque<CallEvent> = ConcurrentLinkedDeque()
    
      /** The full set of events, used to match starts with ends. */
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Wed Nov 05 18:28:35 UTC 2025
    - 4.5K bytes
    - Viewed (0)
  10. okhttp/src/commonJvmAndroid/kotlin/okhttp3/Call.kt

       */
      fun timeout(): Timeout
    
      /**
       * Configure this call to publish all future events to [eventListener], in addition to the
       * listeners configured by [OkHttpClient.Builder.eventListener] and other calls to this function.
       *
       * If this call is later [cloned][clone], [eventListener] will not be notified of its events.
       *
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Wed Nov 05 18:28:35 UTC 2025
    - 6.8K bytes
    - Viewed (0)
Back to top