gpt4 book ai didi

org.xnio.ssl.XnioSsl.createSslConnectionServer()方法的使用及代码示例

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

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

XnioSsl.createSslConnectionServer介绍

[英]Create a bound TCP SSL server.
[中]创建绑定的TCP SSL服务器。

代码示例

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

@Override
protected void startListening(XnioWorker worker, InetSocketAddress socketAddress, ChannelListener<AcceptingChannel<StreamConnection>> acceptListener) throws IOException {
  if(proxyProtocol) {
    sslServer = worker.createStreamConnectionServer(socketAddress, (ChannelListener) acceptListener, getSSLOptions(sslContextSupplier.get()));
  } else {
    XnioSsl ssl = getSsl();
    sslServer = ssl.createSslConnectionServer(worker, socketAddress, (ChannelListener) acceptListener, getSSLOptions(sslContextSupplier.get()));
  }
  sslServer.resumeAccepts();
  final InetSocketAddress boundAddress = sslServer.getLocalAddress(InetSocketAddress.class);
  UndertowLogger.ROOT_LOGGER.listenerStarted("HTTPS", getName(), NetworkUtils.formatIPAddressForURI(boundAddress.getAddress()), boundAddress.getPort());
}

代码示例来源:origin: org.wildfly/wildfly-undertow

@Override
protected void startListening(XnioWorker worker, InetSocketAddress socketAddress, ChannelListener<AcceptingChannel<StreamConnection>> acceptListener) throws IOException {
  if(proxyProtocol) {
    sslServer = worker.createStreamConnectionServer(socketAddress, (ChannelListener) acceptListener, getSSLOptions(sslContextSupplier.get()));
  } else {
    XnioSsl ssl = getSsl();
    sslServer = ssl.createSslConnectionServer(worker, socketAddress, (ChannelListener) acceptListener, getSSLOptions(sslContextSupplier.get()));
  }
  sslServer.resumeAccepts();
  final InetSocketAddress boundAddress = sslServer.getLocalAddress(InetSocketAddress.class);
  UndertowLogger.ROOT_LOGGER.listenerStarted("HTTPS", getName(), NetworkUtils.formatIPAddressForURI(boundAddress.getAddress()), boundAddress.getPort());
}

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

@Override
protected void startListening(XnioWorker worker, InetSocketAddress socketAddress, ChannelListener<AcceptingChannel<StreamConnection>> acceptListener) throws IOException {
  if(proxyProtocol) {
    sslServer = worker.createStreamConnectionServer(socketAddress, (ChannelListener) acceptListener, getSSLOptions(sslContextSupplier.get()));
  } else {
    XnioSsl ssl = getSsl();
    sslServer = ssl.createSslConnectionServer(worker, socketAddress, (ChannelListener) acceptListener, getSSLOptions(sslContextSupplier.get()));
  }
  sslServer.resumeAccepts();
  final InetSocketAddress boundAddress = sslServer.getLocalAddress(InetSocketAddress.class);
  UndertowLogger.ROOT_LOGGER.listenerStarted("HTTPS", getName(), NetworkUtils.formatIPAddressForURI(boundAddress.getAddress()), boundAddress.getPort());
}

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

@Override
protected void setUpClient(NetworkHandler client, int port, boolean secure) throws IOException {
  HttpHandler handler = new ActHttpHandler(client);
  ByteBufferPool buffers = new DefaultByteBufferPool(true, 16 * 1024, -1, 4);
  HttpOpenListener openListener = new HttpOpenListener(buffers, serverOptions);
  openListener.setRootHandler(handler);
  ChannelListener<AcceptingChannel<StreamConnection>> acceptListener = ChannelListeners.openListenerAdapter(openListener);
  if (!secure) {
    AcceptingChannel<? extends StreamConnection> server = worker.createStreamConnectionServer(new InetSocketAddress(port), acceptListener, socketOptions);
    server.resumeAccepts();
    channels.add(server);
  } else {
    XnioSsl xnioSsl;
    try {
      SSLContext sslContext = createSSLContext(loadKeyStore("server.keystore"), loadKeyStore("server.truststore"));
      xnioSsl = new UndertowXnioSsl(xnio, OptionMap.create(Options.USE_DIRECT_BUFFERS, true), sslContext);
      AcceptingChannel<SslConnection> sslServer = xnioSsl.createSslConnectionServer(worker, new InetSocketAddress(port), (ChannelListener)acceptListener, socketOptions);
      sslServer.resumeAccepts();
      channels.add(sslServer);
    } catch (Exception e) {
      throw E.unexpected(e);
    }
  }
}

代码示例来源:origin: org.actframework/act

@Override
protected void setUpClient(NetworkHandler client, int port, boolean secure) throws IOException {
  HttpHandler handler = new ActHttpHandler(client);
  ByteBufferPool buffers = new DefaultByteBufferPool(true, 16 * 1024, -1, 4);
  HttpOpenListener openListener = new HttpOpenListener(buffers, serverOptions);
  openListener.setRootHandler(handler);
  ChannelListener<AcceptingChannel<StreamConnection>> acceptListener = ChannelListeners.openListenerAdapter(openListener);
  if (!secure) {
    AcceptingChannel<? extends StreamConnection> server = worker.createStreamConnectionServer(new InetSocketAddress(port), acceptListener, socketOptions);
    server.resumeAccepts();
    channels.add(server);
  } else {
    XnioSsl xnioSsl;
    try {
      SSLContext sslContext = createSSLContext(loadKeyStore("server.keystore"), loadKeyStore("server.truststore"));
      xnioSsl = new UndertowXnioSsl(xnio, OptionMap.create(Options.USE_DIRECT_BUFFERS, true), sslContext);
      AcceptingChannel<SslConnection> sslServer = xnioSsl.createSslConnectionServer(worker, new InetSocketAddress(port), (ChannelListener)acceptListener, socketOptions);
      sslServer.resumeAccepts();
      channels.add(sslServer);
    } catch (Exception e) {
      throw E.unexpected(e);
    }
  }
}

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

public void start() {
  try {
    OptionMap.Builder serverOptionsBuilder = OptionMap.builder()
        .set(Options.TCP_NODELAY, true)
        .set(Options.REUSE_ADDRESSES, true);
    ChannelListener acceptListener = ChannelListeners.openListenerAdapter(openListener);
    if (httpAddress != null) {
      normalServer = worker.createStreamConnectionServer(httpAddress, acceptListener, serverOptionsBuilder.getMap());
      normalServer.resumeAccepts();
    }
    if (secureAddress != null) {
      if (sslClientAuthMode != null) {
        serverOptionsBuilder.set(SSL_CLIENT_AUTH_MODE, sslClientAuthMode);
      }
      OptionMap secureOptions = serverOptionsBuilder.getMap();
      XnioSsl xnioSsl = new UndertowXnioSsl(worker.getXnio(), secureOptions, sslContext);
      secureServer = xnioSsl.createSslConnectionServer(worker, secureAddress, acceptListener, secureOptions);
      secureServer.resumeAccepts();
    }
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}

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