当前位置: 首页>>代码示例>>Java>>正文


Java Http2Codec类代码示例

本文整理汇总了Java中okhttp3.internal.http2.Http2Codec的典型用法代码示例。如果您正苦于以下问题:Java Http2Codec类的具体用法?Java Http2Codec怎么用?Java Http2Codec使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Http2Codec类属于okhttp3.internal.http2包,在下文中一共展示了Http2Codec类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newCodec

import okhttp3.internal.http2.Http2Codec; //导入依赖的package包/类
public HttpCodec newCodec(
    OkHttpClient client, StreamAllocation streamAllocation) throws SocketException {
  if (http2Connection != null) {
    return new Http2Codec(client, streamAllocation, http2Connection);
  } else {
    socket.setSoTimeout(client.readTimeoutMillis());
    source.timeout().timeout(client.readTimeoutMillis(), MILLISECONDS);
    sink.timeout().timeout(client.writeTimeoutMillis(), MILLISECONDS);
    return new Http1Codec(client, streamAllocation, source, sink);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:RealConnection.java

示例2: readNameValueBlockDropsForbiddenHeadersHttp2

import okhttp3.internal.http2.Http2Codec; //导入依赖的package包/类
@Test public void readNameValueBlockDropsForbiddenHeadersHttp2() throws IOException {
  List<Header> headerBlock = headerEntries(
      ":status", "200 OK",
      ":version", "HTTP/1.1",
      "connection", "close");
  Request request = new Request.Builder().url("http://square.com/").build();
  Response response = Http2Codec.readHttp2HeadersList(headerBlock).request(request).build();
  Headers headers = response.headers();
  assertEquals(1, headers.size());
  assertEquals(":version", headers.name(0));
  assertEquals("HTTP/1.1", headers.value(0));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:HeadersTest.java

示例3: http2HeadersListDropsForbiddenHeadersHttp2

import okhttp3.internal.http2.Http2Codec; //导入依赖的package包/类
@Test public void http2HeadersListDropsForbiddenHeadersHttp2() {
  Request request = new Request.Builder()
      .url("http://square.com/")
      .header("Connection", "upgrade")
      .header("Upgrade", "websocket")
      .header("Host", "square.com")
      .build();
  List<Header> expected = headerEntries(
      ":method", "GET",
      ":path", "/",
      ":authority", "square.com",
      ":scheme", "http");
  assertEquals(expected, Http2Codec.http2HeadersList(request));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:HeadersTest.java

示例4: newCodec

import okhttp3.internal.http2.Http2Codec; //导入依赖的package包/类
public HttpCodec newCodec(OkHttpClient client, Interceptor.Chain chain,
    StreamAllocation streamAllocation) throws SocketException {
  if (http2Connection != null) {
    return new Http2Codec(client, chain, streamAllocation, http2Connection);
  } else {
    socket.setSoTimeout(chain.readTimeoutMillis());
    source.timeout().timeout(chain.readTimeoutMillis(), MILLISECONDS);
    sink.timeout().timeout(chain.writeTimeoutMillis(), MILLISECONDS);
    return new Http1Codec(client, streamAllocation, source, sink);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:RealConnection.java

示例5: http2HeadersListDropsForbiddenHeadersHttp2

import okhttp3.internal.http2.Http2Codec; //导入依赖的package包/类
@Test public void http2HeadersListDropsForbiddenHeadersHttp2() {
  Request request = new Request.Builder()
      .url("http://square.com/")
      .header("Connection", "upgrade")
      .header("Upgrade", "websocket")
      .build();
  List<Header> expected = headerEntries(
      ":method", "GET",
      ":path", "/",
      ":authority", "square.com",
      ":scheme", "http");
  assertEquals(expected, Http2Codec.http2HeadersList(request));
}
 
开发者ID:RunningTheSnail,项目名称:Okhttp,代码行数:14,代码来源:HeadersTest.java


注:本文中的okhttp3.internal.http2.Http2Codec类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。