Code example for SSLServerSocket

Methods: setEnabledCipherSuites, setNeedClientAuth, setSoTimeout

0
 
  private static TServerSocket createServer(SSLServerSocketFactory factory, int port, int timeout, boolean clientAuth,
                                    InetAddress ifAddress, TSSLTransportParameters params) throws TTransportException {
    try { 
      SSLServerSocket serverSocket = (SSLServerSocket) factory.createServerSocket(port, 100, ifAddress);
      serverSocket.setSoTimeout(timeout);
      serverSocket.setNeedClientAuth(clientAuth);
      if (params != null && params.cipherSuites != null) {
        serverSocket.setEnabledCipherSuites(params.cipherSuites);
      } 
      return new TServerSocket(serverSocket);
    } catch (Exception e) {
      throw new TTransportException("Could not bind to port " + port, e);
    } 
  } 
 
  /** 
   * Get a default SSL wrapped TSocket connected to the specified host and port. All 
   * the client methods return a bound connection. So there is no need to call open() on the  
   * TTransport. 
   *