Protocols connection established handler
770028
def connection_made(self):
        
        LOG.info(
            'Connection to peer: %s established',
            self._neigh_conf.ip_address,
            extra={
                'resource_name': self._neigh_conf.name,
                'resource_id': self._neigh_conf.id
            }
        )
179074
public static void registerUrlProtocolHandler() {
        String handlers = System.getProperty(PROTOCOL_HANDLER, "");
        System.setProperty(PROTOCOL_HANDLER, ("".equals(handlers) ? HANDLERS_PACKAGE
                : handlers + "|" + HANDLERS_PACKAGE));
        resetCachedUrlHandlers();
    }
998069
@Override
    public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent event) {
        // register the newly established channel
        Channel channel = event.getChannel();
        LOG.info("connection established to :{}, local port:{}", client.getRemoteAddr(), channel.getLocalAddress());

        client.connectChannel(ctx.getChannel());
        client.handleResponse(ctx.getChannel(), null);
    }
762513
def handler(ca_file=None):
    """"""

    def request(url, message, **kwargs):
        scheme, host, port, path = spliturl(url)

        if scheme != "https": 
            ValueError("unsupported scheme: %s" % scheme)

        connection = HTTPSConnection(host, port, ca_file)
        try:
            body = message.get('body', "")
            headers = dict(message.get('headers', []))
            connection.request(message['method'], path, body, headers)
            response = connection.getresponse()
        finally:
            connection.close()

        return {
            'status': response.status,
            'reason': response.reason,
            'headers': response.getheaders(),
            'body': BytesIO(response.read())
        }

    return request
1216127
function BasicConnection() {
  var _this = this

  this._disconnected = false
  this._messageHandler = function() {
  }
  this._disconnectHandler = function() {
  }

  var childArgs = []

  process.execArgv.forEach(function(arg) {
    if (arg.indexOf('--debug-brk') !== -1) {
      var _debugPort = parseInt(arg.substr(12)) + 1
      debug('Child process debugger listening on port %d', _debugPort)
      childArgs.push('--debug-brk=' + _debugPort)
    }
  })

  this._process = child_process.fork(__dirname + '/../sandbox/sandbox.js', childArgs)

  this._startHeartBeat()

  this._process.on('message', function(data) {
    var m = codec.decode(data);
    debug('Recibing message: %j', m)
    _this._messageHandler(m)
  })

  this._process.on('exit', function(m) {
    debug('Exit process: %j', m)
    _this._stopHeartBeat()
    _this._disconnected = true
    _this._disconnectHandler(m)
  })
}
1348277
protected void postConnection(ConnectionHandle handle, long statsObtainTime){

		handle.renewConnection(); // mark it as being logically "open"

		// Give an application a chance to do something with it.
		if (handle.getConnectionHook() != null){
			handle.getConnectionHook().onCheckOut(handle);
		}

		if (this.pool.closeConnectionWatch){ // a debugging tool
			this.pool.watchConnection(handle);
		}

		if (this.pool.statisticsEnabled){
			this.pool.statistics.addCumulativeConnectionWaitTime(System.nanoTime()-statsObtainTime);
		}
	}
720356
private void handleRequest(ByteBuf request, ChannelHandlerContext context) {
    NettyConnection connection = getConnection(context.channel());
    if (connection != null) {
      connection.handleRequest(request);
    }
  }
616005
@Override
    public void processConnect(WebSocketChannel channel, WSURI uri, String[] protocols) {
        LOG.entering(CLASS_NAME, "connect", new Object[] { uri, protocols });
        WebSocketNativeChannel wsChannel = (WebSocketNativeChannel)channel;
        wsChannel.balanced.set(0);
        nextHandler.processConnect(channel, uri.addQueryParameter(".kl=Y"), protocols);
    }
739949
def handle_connection(self, client, ssl):
        
        if ssl:
            context = ssl if hasattr(ssl, 'set_ciphers') \
                            else ssl(client) if callable(ssl) \
                            else create_default_context(True)
            transport = SslTransport(client, context, True)
        else:
            transport = Transport(client)
        transport._log = self._log
        transport._server = self
        if DEBUG:
            self._log.debug('new connection on {}', saddr(client.getsockname()))
            if hasattr(client, 'getpeername'):
                self._log.debug('remote peer is {}', saddr(client.getpeername()))
        protocol = self._protocol_factory()
        protocol._log = self._log
        protocol._timeout = self._timeout
        self._connections[transport] = protocol
        self.connection_made(transport, protocol)
        transport.start(protocol)
383585
def wrap_handler(cls, handler, protocol, **kwargs):
        '''  '''
        def _wrapper(request, *args, **kwargs):
            instance = cls(request=request, **kwargs)
            if protocol == Resource.Protocol.http:
                return instance._wrap_http(handler, request=request, **kwargs)
            elif protocol == Resource.Protocol.websocket:
                return instance._wrap_ws(handler, request=request, **kwargs)
            elif protocol == Resource.Protocol.amqp:
                return instance._wrap_amqp(view_type, *args, **kwargs)
            else:
                raise Exception('Communication protocol not specified')
        return _wrapper
1230271
function () {

	if (l_ip_port === undefined) {
		LOG.warn('not init (or already disposed), cannot connect to server');
		return;
	}

	if (l_connector === undefined)    
		l_connector = new SR.Connector(l_config);

    // establish connection
	LOG.warn('connecting to: ' + l_ip_port);
	l_connector.connect(l_ip_port, function (err, socket) {
		
		if (err) {
			// try-again later
			LOG.warn('attempt to re-connect in: ' + l_timeoutConnectRetry + 'ms');
			setTimeout(l_connect, l_timeoutConnectRetry);
			return;
		}
				
		LOG.warn('connection to: ' + socket.host + ':' + socket.port + ' established');
        l_connector.send('SR_REGISTER_SERVER', l_para, 'SR_REGISTER_SERVER_R', function (res) {
            console.log(res.data);
        });
	});    
}
932334
function responseHandler(resp) {
        // Set response var to the response we got back
        // This is so it remains accessable outside this scope
        response = resp;
        // Check for redirect
        // @TODO Prevent looped redirects
        if (response.statusCode === 301 || response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) {
          // Change URL to the redirect location
          settings.url = response.headers.location;
          var url = Url.parse(settings.url);
          // Set host var in case it's used later
          host = url.hostname;
          // Options for the new request
          var newOptions = {
            hostname: url.hostname,
            port: url.port,
            path: url.path,
            method: response.statusCode === 303 ? "GET" : settings.method,
            headers: headers,
            withCredentials: self.withCredentials
          };

          // Issue the new request
          request = doRequest(newOptions, responseHandler).on("error", errorHandler);
          request.end();
          // @TODO Check if an XHR event needs to be fired here
          return;
        }

        response.setEncoding("utf8");

        setState(self.HEADERS_RECEIVED);
        self.status = response.statusCode;

        response.on("data", function(chunk) {
          // Make sure there's some data
          if (chunk) {
            self.responseText += chunk;
          }
          // Don't emit state changes if the connection has been aborted.
          if (sendFlag) {
            setState(self.LOADING);
          }
        });

        response.on("end", function() {
          if (sendFlag) {
            // Discard the end event if the connection has been aborted
            setState(self.DONE);
            sendFlag = false;
          }
        });

        response.on("error", function(error) {
          self.handleError(error);
        });
      }
377169
def connect(self, interface, event, object_path, handler):
        
        if object_path:
            def callback(connection, sender_name, object_path,
                         interface_name, signal_name, parameters):
                return handler(*unpack_variant(parameters))
        else:
            def callback(connection, sender_name, object_path,
                         interface_name, signal_name, parameters):
                return handler(object_path, *unpack_variant(parameters))
        return self.connection.signal_subscribe(
            self.bus_name,
            interface,
            event,
            object_path,
            None,
            Gio.DBusSignalFlags.NONE,
            callback,
        )
1362047
def connectionJustEstablished(self):
        
        assert not self.disconnecting
        assert not self.disconnected
        try:
            p = self.factory.buildProtocol(PTCPAddress(
                    self.peerAddressTuple, self.pseudoPortPair))
            p.makeConnection(self)
        except:
            log.msg("Exception during PTCP connection setup.")
            log.err()
            self.loseConnection()
        else:
            self.protocol = p
175260
public function handleConnect(
        \Erebot\Interfaces\EventHandler $handler,
        \Erebot\Interfaces\Event\Connect $event
    ) {
        $this->connected = true;
    }
1038318
def connection_made(self, transport: asyncio.BaseTransport) -> None:
        
        super().connection_made(transport)
        # Register the connection with the server before creating the handler
        # task. Registering at the beginning of the handler coroutine would
        # create a race condition between the creation of the task, which
        # schedules its execution, and the moment the handler starts running.
        self.ws_server.register(self)
        self.handler_task = self.loop.create_task(self.handler())
1089223
def packet_in_handler(self, req_pkt, req_igmp, msg):
        """"""
        dpid = msg.datapath.id
        ofproto = msg.datapath.ofproto
        if ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
            in_port = msg.in_port
        else:
            in_port = msg.match['in_port']

        log = "SW=%s PORT=%d IGMP received. " % (
            dpid_to_str(dpid), in_port)
        self.logger.debug(str(req_igmp))
        if igmp.IGMP_TYPE_QUERY == req_igmp.msgtype:
            self.logger.info(log + "[QUERY]")
            (req_ipv4, ) = req_pkt.get_protocols(ipv4.ipv4)
            (req_eth, ) = req_pkt.get_protocols(ethernet.ethernet)
            self._do_query(req_igmp, req_ipv4, req_eth, in_port, msg)
        elif (igmp.IGMP_TYPE_REPORT_V1 == req_igmp.msgtype or
              igmp.IGMP_TYPE_REPORT_V2 == req_igmp.msgtype):
            self.logger.info(log + "[REPORT]")
            self._do_report(req_igmp, in_port, msg)
        elif igmp.IGMP_TYPE_LEAVE == req_igmp.msgtype:
            self.logger.info(log + "[LEAVE]")
            self._do_leave(req_igmp, in_port, msg)
        elif igmp.IGMP_TYPE_REPORT_V3 == req_igmp.msgtype:
            self.logger.info(log + "V3 is not supported yet.")
            self._do_flood(in_port, msg)
        else:
            self.logger.info(log + "[unknown type:%d]",
                             req_igmp.msgtype)
            self._do_flood(in_port, msg)