io.vertx.core.http.HttpConnection.setWindowSize()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中io.vertx.core.http.HttpConnection.setWindowSize()方法的一些代码示例,展示了HttpConnection.setWindowSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpConnection.setWindowSize()方法的具体详情如下:
包路径:io.vertx.core.http.HttpConnection
类名称:HttpConnection
方法名:setWindowSize

HttpConnection.setWindowSize介绍

[英]Update the current connection wide window size to a new size.

Increasing this value, gives better performance when several data streams are multiplexed

This is not implemented for HTTP/1.x.
[中]将当前连接宽度窗口大小更新为新大小。
当多个数据流被多路复用时,增加该值可提供更好的性能
这不是为HTTP/1实现的。十、

代码示例

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testUpdateConnectionWindowSize() throws Exception {
 ServerBootstrap bootstrap = createH2Server((decoder, encoder) -> new Http2EventAdapter() {
  @Override
  public void onWindowUpdateRead(ChannelHandlerContext ctx, int streamId, int windowSizeIncrement) throws Http2Exception {
   vertx.runOnContext(v -> {
    assertEquals(65535, windowSizeIncrement);
    testComplete();
   });
  }
 });
 ChannelFuture s = bootstrap.bind(DEFAULT_HTTPS_HOST, DEFAULT_HTTPS_PORT).sync();
 client.get(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, "/somepath", resp -> {
 }).connectionHandler(conn -> {
  assertEquals(65535, conn.getWindowSize());
  conn.setWindowSize(65535 + 10000);
  assertEquals(65535 + 10000, conn.getWindowSize());
  conn.setWindowSize(65535 + 65535);
  assertEquals(65535 + 65535, conn.getWindowSize());
 }).end();
 await();
}

代码示例来源:origin: io.vertx/vertx-rx-java

/**
 * Update the current connection wide window size to a new size.
 * <p/>
 * Increasing this value, gives better performance when several data streams are multiplexed
 * <p/>
 * This is not implemented for HTTP/1.x.
 * @param windowSize the new window size
 * @return a reference to this, so the API can be used fluently
 */
public io.vertx.rxjava.core.http.HttpConnection setWindowSize(int windowSize) { 
 delegate.setWindowSize(windowSize);
 return this;
}

代码示例来源:origin: vert-x3/vertx-rx

/**
 * Update the current connection wide window size to a new size.
 * <p/>
 * Increasing this value, gives better performance when several data streams are multiplexed
 * <p/>
 * This is not implemented for HTTP/1.x.
 * @param windowSize the new window size
 * @return a reference to this, so the API can be used fluently
 */
public io.vertx.rxjava.core.http.HttpConnection setWindowSize(int windowSize) { 
 delegate.setWindowSize(windowSize);
 return this;
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testUpdateConnectionWindowSize() throws Exception {
 ServerBootstrap bootstrap = createH2Server((decoder, encoder) -> new Http2EventAdapter() {
  @Override
  public void onWindowUpdateRead(ChannelHandlerContext ctx, int streamId, int windowSizeIncrement) throws Http2Exception {
   vertx.runOnContext(v -> {
    assertEquals(65535, windowSizeIncrement);
    testComplete();
   });
  }
 });
 ChannelFuture s = bootstrap.bind(DEFAULT_HTTPS_HOST, DEFAULT_HTTPS_PORT).sync();
 client.get(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_HOST, "/somepath", resp -> {
 }).connectionHandler(conn -> {
  assertEquals(65535, conn.getWindowSize());
  conn.setWindowSize(65535 + 10000);
  assertEquals(65535 + 10000, conn.getWindowSize());
  conn.setWindowSize(65535 + 65535);
  assertEquals(65535 + 65535, conn.getWindowSize());
 }).end();
 await();
}

相关文章