javax.net.ssl.SSLServerSocket.setReuseAddress()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(131)

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

SSLServerSocket.setReuseAddress介绍

暂无

代码示例

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

public void setReuseAddress(final boolean on) throws SocketException {
  delegate.setReuseAddress(on);
}

代码示例来源:origin: apache/geode

serverSocket.setReuseAddress(true);

代码示例来源:origin: apache/karaf

@Override
public void setReuseAddress(boolean on) throws SocketException {
  ss.setReuseAddress(on);
}

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

public void setReuseAddress(final boolean on) throws SocketException {
  delegate.setReuseAddress(on);
}

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

public void setReuseAddress(final boolean on) throws SocketException {
  delegate.setReuseAddress(on);
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-ssl

public void setReuseAddress(final boolean on) throws SocketException {
  delegate.setReuseAddress(on);
}

代码示例来源:origin: lindzh/hasting

public static ServerSocket getServerSocketInstance(SSLContext sslContext,int sslmode){
    ServerSocket serverSocket = null;
    try{
      if(sslContext!=null){
        SSLServerSocketFactory factory = sslContext.getServerSocketFactory();
        SSLServerSocket sslServerSocket = (SSLServerSocket)factory.createServerSocket();
        postSSLServerSocket(sslServerSocket,sslmode);
        sslServerSocket.setReuseAddress(true);
      }
    }catch(Exception e){
      logger.error("create ssl server error,start to use socket");
    }
    try{
      if(serverSocket==null){
        serverSocket = new ServerSocket();
      }
    }catch(Exception e){
      throw new RpcException(e);
    }
    return serverSocket;
  }
}

代码示例来源:origin: org.opendaylight.centinel/centinel-streamhandler

/**
 * This starts collection of logs by creating server sockets and starting
 * client threads.
 */
public void start() {
  executor.prestartAllCoreThreads();
  synchronized (serverSocketLock) {
    if (!socketOpen) {
      socketOpen = true;
    }
    if (serverSocket == null) {
      try {
        serverSocket = (SSLServerSocket) ssl.getServerSocketFactory().createServerSocket(syslogPort);
        serverSocket.setReuseAddress(true);
      } catch (IOException e) {
        log.error("Exception while connecting " + e.getMessage(), e);
      }
    }
  }
  socketReader = new SocketReader();
  socketReader.start();
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

public static SSLServerSocket getServerSocket(EncryptionOptions options, InetAddress address, int port) throws IOException
{
  SSLContext ctx = createSSLContext(options, true);
  SSLServerSocket serverSocket = (SSLServerSocket)ctx.getServerSocketFactory().createServerSocket();
  try
  {
    serverSocket.setReuseAddress(true);
    prepareSocket(serverSocket, options);
    serverSocket.bind(new InetSocketAddress(address, port), 500);
    return serverSocket;
  }
  catch (IllegalArgumentException | SecurityException | IOException e)
  {
    serverSocket.close();
    throw e;
  }
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public static SSLServerSocket getServerSocket(EncryptionOptions options, InetAddress address, int port) throws IOException
{
  SSLContext ctx = createSSLContext(options, true);
  SSLServerSocket serverSocket = (SSLServerSocket)ctx.getServerSocketFactory().createServerSocket();
  try
  {
    serverSocket.setReuseAddress(true);
    prepareSocket(serverSocket, options);
    serverSocket.bind(new InetSocketAddress(address, port), 500);
    return serverSocket;
  }
  catch (IllegalArgumentException | SecurityException | IOException e)
  {
    serverSocket.close();
    throw e;
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

public static SSLServerSocket getServerSocket(EncryptionOptions options, InetAddress address, int port) throws IOException
{
  SSLContext ctx = createSSLContext(options, true);
  SSLServerSocket serverSocket = (SSLServerSocket)ctx.getServerSocketFactory().createServerSocket();
  try
  {
    serverSocket.setReuseAddress(true);
    prepareSocket(serverSocket, options);
    serverSocket.bind(new InetSocketAddress(address, port), 500);
    return serverSocket;
  }
  catch (IllegalArgumentException | SecurityException | IOException e)
  {
    serverSocket.close();
    throw e;
  }
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

public static SSLServerSocket getServerSocket(EncryptionOptions options, InetAddress address, int port) throws IOException
{
  SSLContext ctx = createSSLContext(options, true);
  SSLServerSocket serverSocket = (SSLServerSocket)ctx.getServerSocketFactory().createServerSocket();
  serverSocket.setReuseAddress(true);
  String[] suits = filterCipherSuites(serverSocket.getSupportedCipherSuites(), options.cipher_suites);
  serverSocket.setEnabledCipherSuites(suits);
  serverSocket.setNeedClientAuth(options.require_client_auth);
  serverSocket.setEnabledProtocols(ACCEPTED_PROTOCOLS);
  serverSocket.bind(new InetSocketAddress(address, port), 500);
  return serverSocket;
}

代码示例来源:origin: perlundq/yajsync

@Override
  public ServerChannel open(InetAddress address, int port, int timeout)
      throws IOException
  {
    SSLServerSocket sock =
      (SSLServerSocket) _factory.createServerSocket(port,
                             _backlog, address);
    try {
      sock.setReuseAddress(_isReuseAddress);
      sock.setWantClientAuth(_isWantClientAuth);
      return new SSLServerChannel(sock, timeout);
    } catch (Throwable t) {
      if (!sock.isClosed()) {
        try {
          sock.close();
        } catch (Throwable tt) {
          t.addSuppressed(tt);
        }
      }
      throw t;
    }
  }
}

代码示例来源:origin: palantir/conjure-java-runtime

@Override
  public void run() {
    try {
      sslServerSocket.setNeedClientAuth(clientAuth == ClientAuth.WITH_CLIENT_AUTH);
      sslServerSocket.setReuseAddress(true);
      Socket clientSocket = sslServerSocket.accept();
      OutputStreamWriter streamWriter = new OutputStreamWriter(clientSocket.getOutputStream(),
          StandardCharsets.UTF_8);
      PrintWriter out = new PrintWriter(streamWriter, true);
      out.println(message);
      clientSocket.close();
    } catch (IOException e) {
      Throwables.propagate(e);
    }
  }
};

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

serverSocket.setReuseAddress(true);

代码示例来源:origin: org.apache.geode/gemfire-core

serverSocket.setReuseAddress(true);

代码示例来源:origin: BiglySoftware/BiglyBT

ssl_server_socket.setReuseAddress(true);

相关文章