larksuite-oapi/src/main/java/com/larksuite/oapi/okhttp3_14/OkHttpClient.java
public Builder protocols(List<Protocol> protocols) {
      // Create a private copy of the list.
      protocols = new ArrayList<>(protocols);

      // Validate that the list has everything we require and nothing we forbid.
      if (!protocols.contains(Protocol.H2_PRIOR_KNOWLEDGE)
          && !protocols.contains(Protocol.HTTP_1_1)) {
        throw new IllegalArgumentException(
            "protocols must contain h2_prior_knowledge or http/1.1: " + protocols);
      }
      if (protocols.contains(Protocol.H2_PRIOR_KNOWLEDGE) && protocols.size() > 1) {
        throw new IllegalArgumentException(
            "protocols containing h2_prior_knowledge cannot use other protocols: " + protocols);
      }
      if (protocols.contains(Protocol.HTTP_1_0)) {
        throw new IllegalArgumentException("protocols must not contain http/1.0: " + protocols);
      }
      if (protocols.contains(null)) {
        throw new IllegalArgumentException("protocols must not contain null");
      }

      // Remove protocols that we no longer support.
      protocols.remove(Protocol.SPDY_3);

      // Assign as an unmodifiable list. This is effectively immutable.
      this.protocols = Collections.unmodifiableList(protocols);
      return this;
    }
/**
     * Configure the protocols used by this client to communicate with remote servers. By default
     * this client will prefer the most efficient transport available, falling back to more
     * ubiquitous protocols. Applications should only call this method to avoid specific
     * compatibility problems, such as web servers that behave incorrectly when HTTP/2 is enabled.
     *
     * <p>The following protocols are currently supported:
     *
     * <ul>
     *     <li><a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">http/1.1</a>
     *     <li><a href="https://tools.ietf.org/html/rfc7540">h2</a>
     *     <li><a href="https://tools.ietf.org/html/rfc7540#section-3.4">h2 with prior knowledge
     *         (cleartext only)</a>
     * </ul>
     *
     * <p><strong>This is an evolving set.</strong> Future releases include support for transitional
     * protocols. The http/1.1 transport will never be dropped.
     *
     * <p>If multiple protocols are specified, <a
     * href="http://tools.ietf.org/html/draft-ietf-tls-applayerprotoneg">ALPN</a> will be used to
     * negotiate a transport. Protocol negotiation is only attempted for HTTPS URLs.
     *
     * <p>{@link Protocol#HTTP_1_0} is not supported in this set. Requests are initiated with {@code
     * HTTP/1.1}. If the server responds with {@code HTTP/1.0}, that will be exposed by {@link
     * Response#protocol()}.
     *
     * @param protocols the protocols to use, in order of preference. If the list contains {@link
     *     Protocol#H2_PRIOR_KNOWLEDGE} then that must be the only protocol and HTTPS URLs will not
     *     be supported. Otherwise the list must contain {@link Protocol#HTTP_1_1}. The list must
     *     not contain null or {@link Protocol#HTTP_1_0}.
     */
Configure the protocols used by this client to communicate with remote servers. By default
this client will prefer the most efficient transport available, falling back to more
ubiquitous protocols. Applications should only call this method to avoid specific
compatibility problems, such as web servers that behave incorrectly when HTTP/2 is enabled.

The following protocols are currently supported.


http/1.1
h2
h2 with prior knowledge
(cleartext only)


This is an evolving set. Future releases include support for transitional
protocols. The http/1.1 transport will never be dropped.

If multiple protocols are specified, ALPN will be used to
negotiate a transport. Protocol negotiation is only attempted for HTTPS URLs.

 Protocol#HTTP_1_0 is not supported in this set. Requests are initiated with {@code
HTTP/1.1}. If the server responds with  HTTP/1.0, that will be exposed by {@link
Response#protocol()}.

@param protocols the protocols to use, in order of preference. If the list contains {@link
Protocol#H2_PRIOR_KNOWLEDGE} then that must be the only protocol and HTTPS URLs will not
be supported. Otherwise the list must contain  Protocol#HTTP_1_1. The list must
not contain null or  Protocol#HTTP_1_0.
Configure the protocols used by this client to communicate with remote servers . By default this client will prefer the most efficient transport available falling back to more ubiquitous protocols . Applications should only call this method to avoid specific compatibility problems such as web servers that behave incorrectly when HTTP / 2 is enabled . The following protocols are currently supported . http / 1 . 1 h2 h2 with prior knowledge ( cleartext only ) This is an evolving set . Future releases include support for transitional protocols . The http / 1 . 1 transport will never be dropped . If multiple protocols are specified ALPN will be used to negotiate a transport . Protocol negotiation is only attempted for HTTPS URLs . Protocol#HTTP_1_0 is not supported in this set . Requests are initiated with { @code HTTP / 1 . 1 } . If the server responds with HTTP / 1 . 0 that will be exposed by { @link Response#protocol () } . @param protocols the protocols to use in order of preference . If the list contains { @link Protocol#H2_PRIOR_KNOWLEDGE } then that must be the only protocol and HTTPS URLs will not be supported . Otherwise the list must contain Protocol#HTTP_1_1 . The list must not contain null or Protocol#HTTP_1_0 .
public Builder protocols(List<Protocol> protocols) {
      protocols = new ArrayList<>(protocols);
      if (!protocols.contains(Protocol.H2_PRIOR_KNOWLEDGE)
          && !protocols.contains(Protocol.HTTP_1_1)) {
        throw new IllegalArgumentException(
            "protocols must contain h2_prior_knowledge or http/1.1: " + protocols);
      }
      if (protocols.contains(Protocol.H2_PRIOR_KNOWLEDGE) && protocols.size() > 1) {
        throw new IllegalArgumentException(
            "protocols containing h2_prior_knowledge cannot use other protocols: " + protocols);
      }
      if (protocols.contains(Protocol.HTTP_1_0)) {
        throw new IllegalArgumentException("protocols must not contain http/1.0: " + protocols);
      }
      if (protocols.contains(null)) {
        throw new IllegalArgumentException("protocols must not contain null");
      }
      protocols.remove(Protocol.SPDY_3);
      this.protocols = Collections.unmodifiableList(protocols);
      return this;
    }
public Builder protocols ( List < Protocol > protocols ) { protocols = new ArrayList < > ( protocols ) ; if ( ! protocols . contains ( Protocol . H2_PRIOR_KNOWLEDGE ) && ! protocols . contains ( Protocol . HTTP_1_1 ) ) { throw new IllegalArgumentException ( "protocols must contain h2_prior_knowledge or http/1.1: " + protocols ) ; } if ( protocols . contains ( Protocol . H2_PRIOR_KNOWLEDGE ) && protocols . size ( ) > 1 ) { throw new IllegalArgumentException ( "protocols containing h2_prior_knowledge cannot use other protocols: " + protocols ) ; } if ( protocols . contains ( Protocol . HTTP_1_0 ) ) { throw new IllegalArgumentException ( "protocols must not contain http/1.0: " + protocols ) ; } if ( protocols . contains ( null ) ) { throw new IllegalArgumentException ( "protocols must not contain null" ) ; } protocols . remove ( Protocol . SPDY_3 ) ; this . protocols = Collections . unmodifiableList ( protocols ) ; return this ; }
Configure the protocols used by this client to communicate with remote servers.
Configure the protocols used by this client to communicate with remote servers .
// Create a private copy of the list. // Validate that the list has everything we require and nothing we forbid. // Remove protocols that we no longer support. // Assign as an unmodifiable list. This is effectively immutable.