-
- All Implemented Interfaces:
-
java.io.Serializable,java.lang.Comparable
public enum ProtocolProtocols that OkHttp implements for ALPN selection.
Protocol vs Scheme Despite its name, getProtocol returns the scheme (http, https, etc.) of the URL, not the protocol (http/1.1, spdy/3.1, etc.). OkHttp uses the word protocol to identify how HTTP messages are framed.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description QUICQUIC (Quick UDP Internet Connection) is a new multiplexed and secure transport atop UDP,designed from the ground up and optimized for HTTP/2 semantics.HTTP/1.1 semantics are layered on HTTP/2.
QUIC is not natively supported by OkHttp, but provided to allow a theoreticalinterceptor that provides support.
H2_PRIOR_KNOWLEDGECleartext HTTP/2 with no "upgrade" round trip. This option requires the client to have priorknowledge that the server supports cleartext HTTP/2.
HTTP_2The IETF's binary-framed protocol that includes header compression, multiplexing multiplerequests on the same socket, and server-push. HTTP/1.1 semantics are layered on HTTP/2.
HTTP/2 requires deployments of HTTP/2 that use TLS 1.2 support , present in Java 8+ and Android 5+. Serversthat enforce this may send an exception message including the string
{@code * INADEQUATE_SECURITY}.SPDY_3Chromium's binary-framed protocol that includes header compression, multiplexing multiplerequests on the same socket, and server-push. HTTP/1.1 semantics are layered on SPDY/3.
Current versions of OkHttp do not support this protocol.
HTTP_1_1A plaintext framing that includes persistent connections.
This version of OkHttp implements RFC7230, and tracks revisions to that spec.
HTTP_1_0An obsolete plaintext framing that does not use persistent sockets by default.
-
Method Summary
Modifier and Type Method Description static Protocolget(String protocol)Returns the protocol identified by {@code protocol}.StringtoString()Returns the string used to identify this protocol for ALPN, like "http/1.1", "spdy/3.1" or"h2". static Array<Protocol>values()static ProtocolvalueOf(String name)
-