gpt4 book ai didi

io.undertow.websockets.client.WebSocketClient.connectionBuilder()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 06:45:05 26 4
gpt4 key购买 nike

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

WebSocketClient.connectionBuilder介绍

[英]Creates a new connection builder that can be used to create a web socket connection.
[中]创建可用于创建web套接字连接的新连接生成器。

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Create a {@link ConnectionBuilder} for the given URI.
 * <p>The default implementation creates a builder with the configured
 * {@link #getXnioWorker() XnioWorker} and {@link #getByteBufferPool() ByteBufferPool} and
 * then passes it to the {@link #getConnectionBuilderConsumer() consumer}
 * provided at construction time.
 */
protected ConnectionBuilder createConnectionBuilder(URI url) {
  ConnectionBuilder builder = io.undertow.websockets.client.WebSocketClient
      .connectionBuilder(getXnioWorker(), getByteBufferPool(), url);
  this.builderConsumer.accept(builder);
  return builder;
}

代码示例来源:origin: wildfly/wildfly

@Deprecated
public static IoFuture<WebSocketChannel> connect(XnioWorker worker, XnioSsl ssl, final ByteBufferPool bufferPool, final OptionMap optionMap, InetSocketAddress bindAddress, final URI uri, WebSocketVersion version, WebSocketClientNegotiation clientNegotiation, Set<ExtensionHandshake> clientExtensions) {
  return connectionBuilder(worker, bufferPool, uri)
      .setSsl(ssl)
      .setOptionMap(optionMap)
      .setBindAddress(bindAddress)
      .setVersion(version)
      .setClientNegotiation(clientNegotiation)
      .setClientExtensions(clientExtensions)
      .connect();
}

代码示例来源:origin: org.springframework/spring-web-reactive

/**
 * Create a {@link ConnectionBuilder} for the given URI.
 * <p>The default implementation creates a builder with the configured
 * {@link #getXnioWorker() XnioWorker} and {@link #getPoolBufferSize()} and
 * then passes it to the {@link #getConnectionBuilderConsumer() consumer}
 * provided at construction time.
 */
protected ConnectionBuilder createConnectionBuilder(URI url) {
  ConnectionBuilder builder = io.undertow.websockets.client.WebSocketClient
      .connectionBuilder(getXnioWorker(),
          new DefaultByteBufferPool(false, getPoolBufferSize()), url);
  this.builderConsumer.accept(builder);
  return builder;
}

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

@Deprecated
public static IoFuture<WebSocketChannel> connect(XnioWorker worker, XnioSsl ssl, final ByteBufferPool bufferPool, final OptionMap optionMap, InetSocketAddress bindAddress, final URI uri, WebSocketVersion version, WebSocketClientNegotiation clientNegotiation, Set<ExtensionHandshake> clientExtensions) {
  return connectionBuilder(worker, bufferPool, uri)
      .setSsl(ssl)
      .setOptionMap(optionMap)
      .setBindAddress(bindAddress)
      .setVersion(version)
      .setClientNegotiation(clientNegotiation)
      .setClientExtensions(clientExtensions)
      .connect();
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Deprecated
public static IoFuture<WebSocketChannel> connect(XnioWorker worker, XnioSsl ssl, final ByteBufferPool bufferPool, final OptionMap optionMap, InetSocketAddress bindAddress, final URI uri, WebSocketVersion version, WebSocketClientNegotiation clientNegotiation, Set<ExtensionHandshake> clientExtensions) {
  return connectionBuilder(worker, bufferPool, uri)
      .setSsl(ssl)
      .setOptionMap(optionMap)
      .setBindAddress(bindAddress)
      .setVersion(version)
      .setClientNegotiation(clientNegotiation)
      .setClientExtensions(clientExtensions)
      .connect();
}

代码示例来源:origin: com.obsidiandynamics.socketx/socketx-undertow

@Override
public UndertowEndpoint connect(URI uri, XEndpointListener<? super UndertowEndpoint> listener) throws Exception {
 final int bufferSize = UndertowAtts.BUFFER_SIZE.get(config.attributes);
 final boolean directBuffers = UndertowAtts.DIRECT_BUFFERS.get(config.attributes);
 final ByteBufferPool pool = new DefaultByteBufferPool(directBuffers, bufferSize);
 final ConnectionBuilder builder = WebSocketClient.connectionBuilder(worker, pool, uri);
 if (uri.getScheme().equals("wss")) {
  final SSLContext sslContext = config.sslContextProvider.getSSLContext();
  final ByteBufferPool sslBufferPool = new DefaultByteBufferPool(directBuffers, 17 * 1024);
  final XnioSsl ssl = new UndertowXnioSsl(worker.getXnio(), OptionMap.EMPTY, sslBufferPool, sslContext);
  builder.setSsl(ssl);
 }
 final WebSocketChannel channel = builder.connect().get(); 
 return UndertowEndpoint.clientOf(scanner, channel, config, listener);
}

代码示例来源:origin: org.spincast/spincast-plugins-http-client-with-websocket

protected ConnectionBuilder createConnectionBuilder(XnioWorker worker,
                          DefaultByteBufferPool bufferPool,
                          String url) {
  URI uri = createWebsocketUri(url);
  ConnectionBuilder connectionBuilder = WebSocketClient.connectionBuilder(worker, bufferPool, uri);
  addSslContext(connectionBuilder);
  connectionBuilder.setClientNegotiation(new WebSocketClientNegotiation(createSupportedSubProtocols(),
                                     createSupportedExtensions()) {
    @Override
    public void beforeRequest(final Map<String, List<String>> headers) {
      //==========================================
      // Add custom headers
      //==========================================
      addCustomHeaders(headers);
      //==========================================
      // Add cookies
      //==========================================
      addCustomCookies(headers);
      //==========================================
      // Add HTTP authenticatiin headers
      //==========================================
      addHttpAuthHeaders(headers);
    }
  });
  return connectionBuilder;
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com