类 Transmitter

java.lang.Object
com.lark.oapi.okhttp.internal.connection.Transmitter

public final class Transmitter extends Object
Bridge between OkHttp's application and network layers. This class exposes high-level application layer primitives: connections, requests, responses, and streams.

This class supports asynchronous canceling. This is intended to have the smallest blast radius possible. If an HTTP/2 stream is active, canceling will cancel that stream but not the other streams sharing its connection. But if the TLS handshake is still in progress then canceling may break the entire connection.

  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • timeout

      public Timeout timeout()
    • timeoutEnter

      public void timeoutEnter()
    • timeoutEarlyExit

      public void timeoutEarlyExit()
      Stops applying the timeout before the call is entirely complete. This is used for WebSockets and duplex calls where the timeout only applies to the initial setup.
    • callStart

      public void callStart()
    • prepareToConnect

      public void prepareToConnect(Request request)
      Prepare to create a stream to carry request. This prefers to use the existing connection if it exists.
    • exchangeDoneDueToException

      public void exchangeDoneDueToException()
    • noMoreExchanges

      @Nullable public IOException noMoreExchanges(@Nullable IOException e)
    • canRetry

      public boolean canRetry()
    • hasExchange

      public boolean hasExchange()
    • cancel

      public void cancel()
      Immediately closes the socket connection if it's currently held. Use this to interrupt an in-flight request from any thread. It's the caller's responsibility to close the request body and response body streams; otherwise resources may be leaked.

      This method is safe to be called concurrently, but provides limited guarantees. If a transport layer connection has been established (such as a HTTP/2 stream) that is terminated. Otherwise if a socket connection is being established, that is terminated.

    • isCanceled

      public boolean isCanceled()