Creates the SSL ServerSocket.
333090
public static ServerSocketBar createJNI(InetAddress host, int port)
    throws IOException
  {
      return currentFactory().create(host, port, 0, true);
  }
27599
protected function createSwooleServer()
    {
        $server = $this->isWebsocket ? WebsocketServer::class : HttpServer::class;
        $config = $this->app->make('config');
        $host = $config->get('swoole_http.server.host');
        $port = $config->get('swoole_http.server.port');
        $socketType = $config->get('swoole_http.server.socket_type', SWOOLE_SOCK_TCP);
        $processType = $config->get('swoole.http.server.process_type', SWOOLE_PROCESS);

        static::$server = new $server($host, $port, $processType, $socketType);
    }
1077680
private SSLSocketFactory createFactory()
    throws Exception
  {
    SSLSocketFactory ssFactory = null;
    
    String host = "localhost";
    int port = 8086;
    
    if (_keyStore == null) {
      return createAnonymousFactory(null, port);
    }
    
    SSLContext sslContext = SSLContext.getInstance(_sslContext);

    KeyManagerFactory kmf
    = KeyManagerFactory.getInstance(keyManagerFactory());

    kmf.init(_keyStore, keyStorePassword().toCharArray());

    sslContext.init(kmf.getKeyManagers(), null, null);

    /*
      if (_cipherSuites != null)
        sslContext.createSSLEngine().setEnabledCipherSuites(_cipherSuites);

     */
    SSLEngine engine = sslContext.createSSLEngine();
    
    _enabledProtocols = enabledProtocols(engine.getEnabledProtocols());
    
    engine.setEnabledProtocols(_enabledProtocols);

    ssFactory = sslContext.getSocketFactory();
    
    return ssFactory;
  }
208967
public static ServerSocketBar create(int port, int listenBacklog)
    throws IOException
  {
    return create(null, port, listenBacklog, true);
  }
814082
public static SSLServerSocketChannel open(int port, SSLContext sslContext) throws IOException
    {
        return open(new InetSocketAddress(port), sslContext);
    }
970252
public SSLSocketFactory build() throws NoSuchAlgorithmException, KeyManagementException{
		SSLContext sslContext = SSLContext.getInstance(protocol);
		sslContext.init(this.keyManagers, this.trustManagers, this.secureRandom);
		return sslContext.getSocketFactory();
	}
1068976
def _create_socket(self, socket_family):
        
        sock = socket.socket(socket_family, socket.SOCK_STREAM, 0)
        sock.settimeout(self._parameters['timeout'] or None)
        if self.use_ssl:
            if not compatibility.SSL_SUPPORTED:
                raise AMQPConnectionError(
                    'Python not compiled with support for TLSv1 or higher'
                )
            sock = self._ssl_wrap_socket(sock)
        return sock
423017
def connect(self, addr):
        """"""
        # Here we assume that the socket is client-side, and not
        # connected at the time of the call.  We connect it, then wrap it.
        if self._sslobj:
            raise ValueError("attempt to connect already-connected SSLSocket!")
        socket.connect(self, addr)
        if six.PY3:
            self._sslobj = self.context._wrap_socket(self._sock, False, self.server_hostname)
        else:
            if self.ciphers is None:
                self._sslobj = _ssl.sslwrap(self._sock, False, self.keyfile, self.certfile,
                                            self.cert_reqs, self.ssl_version,
                                            self.ca_certs)
            else:
                self._sslobj = _ssl.sslwrap(self._sock, False, self.keyfile, self.certfile,
                                            self.cert_reqs, self.ssl_version,
                                            self.ca_certs, self.ciphers)
        if self.do_handshake_on_connect:
            self.do_handshake()
44366
private void openAndBindSocket() {
    try {
      this.clientSocket = new MulticastSocket();
      Utils.selectAppropriateInterface(clientSocket);
      this.clientSocket.joinGroup(SsdpParams.getSsdpMulticastAddress());
    } catch (IOException e) {
      callback.onFailed(e);
    }
  }
804228
def wrap_socket(self, sock, server_side=False,
                    do_handshake_on_connect=True,
                    suppress_ragged_eofs=True, dummy=None):
        
        return ssl.wrap_socket(sock, keyfile=self._keyfile,
                               certfile=self._certfile,
                               server_side=server_side,
                               cert_reqs=self._verify_mode,
                               ssl_version=self._protocol,
                               ca_certs=self._cafile,
                               do_handshake_on_connect=do_handshake_on_connect,
                               suppress_ragged_eofs=suppress_ragged_eofs)
326355
private TSocket createTLSSocket(String host) throws TTransportException {
        TSSLTransportParameters sslParams = new TSSLTransportParameters("SSL", m_dbtls_cipher_suites);
        if (!Utils.isEmpty(m_keystore)) {
            sslParams.setKeyStore(m_keystore, m_keystorepassword);
        }
        if (!Utils.isEmpty(m_truststore)) {
            sslParams.setTrustStore(m_truststore, m_truststorepassword);
        }
        return TSSLTransportFactory.getClientSocket(host, m_dbport, m_db_timeout_millis, sslParams);
    }
26566
@SuppressWarnings("checkstyle:AbbreviationAsWordInName")
    public static SSLConnectionSocketFactory createUnsafeSSLConnectionSocketFactory() {
        try {
            final SSLContextBuilder builder = new SSLContextBuilder();
            builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
            return new SSLConnectionSocketFactory(builder.build(), new NaiveHostnameVerifier());
        } catch (final Exception e) {
            throw new IllegalStateException(e);
        }
    }
1298459
def _connect(self):
        ""
        sock = super(SSLConnection, self)._connect()
        if hasattr(ssl, "create_default_context"):
            context = ssl.create_default_context()
            context.check_hostname = False
            context.verify_mode = self.cert_reqs
            if self.certfile and self.keyfile:
                context.load_cert_chain(certfile=self.certfile,
                                        keyfile=self.keyfile)
            if self.ca_certs:
                context.load_verify_locations(self.ca_certs)
            sock = context.wrap_socket(sock, server_hostname=self.host)
        else:
            # In case this code runs in a version which is older than 2.7.9,
            # we want to fall back to old code
            sock = ssl.wrap_socket(sock,
                                   cert_reqs=self.cert_reqs,
                                   keyfile=self.keyfile,
                                   certfile=self.certfile,
                                   ca_certs=self.ca_certs)
        return sock
1098572
public SSLSocket buildSocket() throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException, UnrecoverableKeyException, KeyManagementException
    {
        if (host == null) throw new IllegalStateException("Cannot create socket without host");

        // Get socket
        final SSLSocket s = (SSLSocket) build().getSocketFactory().createSocket(host, port);

        // Set protocols
        s.setEnabledProtocols(TLS.getUsable(TLS.TLS_PROTOCOLS, s.getSupportedProtocols()));
        s.setEnabledCipherSuites(TLS.getUsable(TLS.TLS_CIPHER_SUITES, s.getSupportedCipherSuites()));

        return s;
    }
947866
public MpnsService build() {
        checkInitialization();

        // Client Configuration
        HttpClient client;
        if (httpClient != null) {
            client = httpClient;
        } else if (pooledMax == 1) {
            client = new DefaultHttpClient();
        } else {
            client = new DefaultHttpClient(Utilities.poolManager(pooledMax));
        }

        if (proxy != null) {
            client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
        }
        
        if( securityInfo != null ) {
        	try {
	        	KeyStore keyStore;
	        	if( securityInfo.getProvider() == null ) {
	        		keyStore = KeyStore.getInstance(securityInfo.getName());
	        	} else {
	        		keyStore = KeyStore.getInstance(securityInfo.getName(), securityInfo.getProvider());
	        	}
	        	keyStore.load(new ByteArrayInputStream(securityInfo.getCert()),
	        			securityInfo.getPassword().toCharArray());
	        				
	        	KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
	        	kmfactory.init(keyStore, securityInfo.getPassword().toCharArray());
	        	KeyManager[] km = kmfactory.getKeyManagers();
	
	        	// create SSL socket factory
	        	SSLContext sslContext = SSLContext.getInstance("TLS");
	        	sslContext.init(km, null, null);
	        	org.apache.http.conn.ssl.SSLSocketFactory sslSocketFactory = new org.apache.http.conn.ssl.SSLSocketFactory(sslContext);
	     
	        	Scheme https = new Scheme("https", 443, sslSocketFactory);
	        	client.getConnectionManager().getSchemeRegistry().register(https);
        	} catch( Exception e ) {
        		throw new IllegalArgumentException(e);
        	}
        }

        if (timeout > 0) {
            HttpParams params = client.getParams();
            HttpConnectionParams.setConnectionTimeout(params, timeout);
            HttpConnectionParams.setSoTimeout(params, timeout);
        }

        // Configure service
        AbstractMpnsService service;
        if (pooledMax == 1) {
            service = new MpnsServiceImpl(client, delegate);
        } else {
            service = new MpnsPooledService(client, executor, delegate);
        }

        if (isQueued) {
            service = new MpnsQueuedService(service);
        }

        service.start();
        return service;
    }
831423
public static SocketIOServer newInstance(int port, SSLContext sslContext) {
    SslContext nettySslContext = new JdkSslContext(sslContext, false, ClientAuth.NONE);
    return newInstance(port, nettySslContext);
  }
339801
public SSLSocket newSslSocket() throws IOException {
        SSLSocketFactory factory = sslContext.getSocketFactory();
        
        SSLSocket socket = (SSLSocket)factory.createSocket();
        
        if (sslConfig.getWantClientAuth())
            socket.setWantClientAuth(sslConfig.getWantClientAuth());
        if (sslConfig.getNeedClientAuth())
            socket.setNeedClientAuth(sslConfig.getNeedClientAuth());

        socket.setEnabledCipherSuites(selectCipherSuites(socket.getEnabledCipherSuites(),
							 socket.getSupportedCipherSuites()));   
        socket.setEnabledProtocols(selectProtocols(socket.getEnabledProtocols(),socket.getSupportedProtocols()));

        return socket;
    }