Create the Protocol instance.

        See the documentation of
        `twisted.internet.protocol.ReconnectingClientFactory` for details.
540083
def buildProtocol(self, addr):
        
        self._client = self.protocol(self._parameters, confirms=self.confirms)
        self._client.factory = self

        @defer.inlineCallbacks
        def on_ready(unused_param=None):
            """Reset the connection delay when the AMQP handshake is complete."""
            _std_log.debug("AMQP handshake completed; connection ready for use")
            self.resetDelay()
            self._client_deferred.callback(self._client)
            self._client_deferred = defer.Deferred()

            # Restart any consumer from previous connections that wasn't canceled
            # including queues and bindings, as the queue might not have been durable
            for consumer, queue, bindings in self._consumers.values():
                _std_log.info("Re-registering the %r consumer", consumer)
                yield self._client.declare_queues([queue])
                yield self._client.bind_queues(bindings)
                yield self._client.consume(consumer.callback, consumer.queue, consumer)

        def on_ready_errback(failure):
            """If opening the connection fails or is lost, this errback is called."""
            if failure.check(pika.exceptions.AMQPConnectionError, error.ConnectionDone):
                # In this case the connection failed to open. This will be called
                # if the TLS handshake goes wrong (likely) and it may be called if
                # the AMQP handshake fails. It's *probably* a problem with the
                # credentials.
                msg = (
                    "The TCP connection appears to have started, but the TLS or AMQP handshake "
                    "with the broker failed; check your connection and authentication "
                    "parameters and ensure your user has permission to access the vhost"
                )
                wrapped_failure = Failure(
                    exc_value=ConnectionException(reason=msg, original=failure),
                    exc_type=ConnectionException,
                )
                self._client_deferred.errback(wrapped_failure)
            else:
                # Some unexpected exception happened
                _std_log.exception(
                    "The connection failed with an unexpected exception; please report this bug."
                )

        self._client.ready.addCallback(on_ready)
        self._client.ready.addErrback(on_ready_errback)
        return self._client
1118796
def _create_connection(self):
        
        transport = SSL if self.ssl else TCP
        return transport(self.server, self.port)
227120
def create_server(
            self,
            loop: asyncio.AbstractEventLoop,
            sock: Any,
            ssl: SSLContext,
    ) -> TypeGenerator[Any, None, Server]:
        
        if loop is not None and self._loop is not loop:
            self._loop = loop
        return (yield from self.listen(
            sock=sock,
            ssl=ssl,
        ))
316577
def create(host, port, result_converter=None, testcase_converter=None, args=None):
    
    return SampleClient(host, port, result_converter, testcase_converter, args)
51513
static ClientDatanodeProtocol createClientDatanodeProtocolProxy (
      DatanodeInfo datanodeid, Configuration conf) throws IOException {
    InetSocketAddress addr = NetUtils.createSocketAddr(
      datanodeid.getHost() + ":" + datanodeid.getIpcPort());
    if (ClientDatanodeProtocol.LOG.isDebugEnabled()) {
      ClientDatanodeProtocol.LOG.info("ClientDatanodeProtocol addr=" + addr);
    }
    try {
      return (ClientDatanodeProtocol)RPC.getProxy(ClientDatanodeProtocol.class,
        ClientDatanodeProtocol.versionID, addr, conf);
    } catch (RPC.VersionMismatch e) {
      long clientVersion = e.getClientVersion();
      long datanodeVersion = e.getServerVersion();
      if (clientVersion > datanodeVersion &&
          !ProtocolCompatible.isCompatibleClientDatanodeProtocol(
              clientVersion, datanodeVersion)) {
        throw new RPC.VersionIncompatible(
            ClientDatanodeProtocol.class.getName(), clientVersion, datanodeVersion);
      }
      return (ClientDatanodeProtocol)e.getProxy();
    }
  }
593009
public CloseableHttpClient NewHttpClient() throws Exception {
    	SSLContext sslcontext = SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();
    	SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext);
    	this.httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build();
    	return this.httpclient;
    }
1068451
public static AltsProtocolNegotiator createClientNegotiator(
      final TsiHandshakerFactory handshakerFactory, final LazyChannel lazyHandshakerChannel) {
    final class ClientAltsProtocolNegotiator extends AltsProtocolNegotiator {

      @Override
      public ChannelHandler newHandler(GrpcHttp2ConnectionHandler grpcHandler) {
        TsiHandshaker handshaker = handshakerFactory.newHandshaker(grpcHandler.getAuthority());
        return new BufferUntilAltsNegotiatedHandler(
            grpcHandler,
            new TsiHandshakeHandler(new NettyTsiHandshaker(handshaker)),
            new TsiFrameHandler());
      }

      @Override
      public void close() {
        logger.finest("ALTS Client ProtocolNegotiator Closed");
        lazyHandshakerChannel.close();
      }
    }

    return new ClientAltsProtocolNegotiator();
  }
530563
def _create_websession(self):
        """"""
        from socket import AF_INET
        from aiohttp import ClientTimeout, TCPConnector

        _LOGGER.debug('Creating web session')
        conn = TCPConnector(
            family=AF_INET,
            limit_per_host=5,
            enable_cleanup_closed=True,
        )

        # Create session object.
        session_timeout = ClientTimeout(connect=10)
        self._websession = ClientSession(connector=conn,
                                         timeout=session_timeout)
        self._supplied_websession = False
1026362
def create(cls, interface_id, logical_interface_ref, **kw):
        
        data = {'inspect_unspecified_vlans': True,
                'logical_interface_ref': logical_interface_ref,
                'nicid': str(interface_id)}
        
        if 'reset_interface_nicid' in kw:
            data.update(reset_interface_nicid=kw.get('reset_interface_nicid'))

        return cls(data)
113351
def create_connction(host, port, protocol):
    
    ai_list = socket.getaddrinfo(host, port, socket.AF_UNSPEC,
                                 socket.SOCK_STREAM)
    for (family, socktype, proto, canon, sockaddr) in ai_list:
        sock = socket.socket(family, socktype)
        # WRAP SOCKET
        if port == 443:
            sock = ssl.wrap_socket(sock, ssl_version=protocol)
        sock.connect(sockaddr)
        return sock
165138
private CloseableHttpClient createHttpClient() throws AzkabanClientException {
    try {
    // SSLSocketFactory using custom TrustStrategy that ignores warnings about untrusted certificates
    // Self sign SSL
    SSLContextBuilder sslcb = new SSLContextBuilder();
    sslcb.loadTrustMaterial(null, (TrustStrategy) new TrustSelfSignedStrategy());
    SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcb.build());

    HttpClientBuilder builder = HttpClientBuilder.create();
    RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT)
          .setSocketTimeout(10000)
          .setConnectTimeout(10000)
          .setConnectionRequestTimeout(10000)
          .build();

      builder.disableCookieManagement()
          .useSystemProperties()
          .setDefaultRequestConfig(requestConfig)
          .setConnectionManager(new BasicHttpClientConnectionManager())
          .setSSLSocketFactory(sslsf);

      return builder.build();
    } catch (Exception e) {
      throw new AzkabanClientException("HttpClient cannot be created", e);
    }
  }
1005544
def buildProtocol(self, addr):
        
        self.resetDelay()
        self.client = self.protocol(self._parameters)
        self.client.factory = self
        self.client.ready.addCallback(lambda _: self._on_client_ready())
        return self.client
954859
public static HttpClient<ByteBuf, ByteBuf> newClient(ConnectionProviderFactory<ByteBuf, ByteBuf> providerFactory,
                                                         Observable<Host> hostStream) {
        return HttpClientImpl.create(providerFactory, hostStream);
    }
636453
function Protocol(remote, socket, version, maxFrameSize) {

    function protocol() {
        this.socket = socket;
        this.maxFrameSize = maxFrameSize;
        this.isConnected = true;
        this.remote = remote;
    }

    protocol.prototype = {
        6: Protocol6,
        13: Protocol13

    }[version];

    return new protocol();

}
1242266
private static void createFactoryInstance() throws Exception {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createFactoryInstance");
    try {
      Class cls = Class.forName(CONTROL_MESSAGE_FACTORY_CLASS);
      instance = (ControlMessageFactory) cls.newInstance();
    }
    catch (Exception e) {
      FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.ControlMessageFactory.createFactoryInstance", "112");
      SibTr.error(tc,"UNABLE_TO_CREATE_CONTROLFACTORY_CWSIF0041",e);
      throw e;
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createFactoryInstance");
  }
266684
def create_controller(self):
        
        body = None
        req = self.request
        res = self.response
        rou = self.router
        con = None

        controller_info = {}
        try:
            controller_info = rou.find(req, res)

        except IOError as e:
            logger.warning(str(e), exc_info=True)
            raise CallError(
                408,
                "The client went away before the request body was retrieved."
            )

        except (ImportError, AttributeError, TypeError) as e:
            exc_info = sys.exc_info()
            logger.warning(str(e), exc_info=exc_info)
            raise CallError(
                404,
                "{} not found because of {} \"{}\" on {}:{}".format(
                    req.path,
                    exc_info[0].__name__,
                    str(e),
                    os.path.basename(exc_info[2].tb_frame.f_code.co_filename),
                    exc_info[2].tb_lineno
                )
            )

        else:
            con = controller_info['class_instance']

        return con
746831
public static TcpClient<ByteBuf, ByteBuf> newClient(ConnectionProviderFactory<ByteBuf, ByteBuf> providerFactory,
                                                        Observable<Host> hostStream) {
        return TcpClientImpl.create(providerFactory, hostStream);
    }