Check if the connection has succeed

            Returns:
                Returns True if connection has succeed.
                False otherwise.
557034
def has_succeed(self):
        
        status_code = self._response.status_code

        if status_code in [HTTP_CODE_ZERO, HTTP_CODE_SUCCESS, HTTP_CODE_CREATED, HTTP_CODE_EMPTY, HTTP_CODE_MULTIPLE_CHOICES]:
            return True

        if status_code in [HTTP_CODE_BAD_REQUEST, HTTP_CODE_UNAUTHORIZED, HTTP_CODE_PERMISSION_DENIED, HTTP_CODE_NOT_FOUND, HTTP_CODE_METHOD_NOT_ALLOWED, HTTP_CODE_CONNECTION_TIMEOUT, HTTP_CODE_CONFLICT, HTTP_CODE_PRECONDITION_FAILED, HTTP_CODE_INTERNAL_SERVER_ERROR, HTTP_CODE_SERVICE_UNAVAILABLE]:
            return False

        raise Exception('Unknown status code %s.', status_code)
755123
public function isConnected()
    {
        if ($this->_connection === null) {
            $connected = false;
        } else {
            try {
                $connected = $this->_connection->query('SELECT 1');
            } catch (PDOException $e) {
                $connected = false;
            }
        }

        return (bool)$connected;
    }
1046407
public function isSuccess() : bool
    {
        Assert::keyExists($this->status, "Code");

        return $this->status['Code'] === Constants::STATUS_SUCCESS;
    }
490462
def _logged_in_successful(data):
        
        if re.match(r'^:(testserver\.local|tmi\.twitch\.tv)'
                    r' NOTICE \* :'
                    r'(Login unsuccessful|Error logging in)*$',
                    data.strip()):
            return False
        else:
            return True
1018886
def _check_connection(self):
        """"""
        try:
            super()._check_connection()
        except OSError as exc:
            _LOGGER.error(exc)
            self.protocol.transport.close()
            self.protocol.conn_lost_callback()
            return
        task = self.loop.call_later(
            self.reconnect_timeout + 0.1, self._check_connection)
        self.cancel_check_conn = task.cancel
473672
def after_start_check(self):
        """"""
        try:
            conn = HTTPConnection(self.host, self.port)

            conn.request('HEAD', self.url.path)
            status = str(conn.getresponse().status)

            if status == self.status or self.status_re.match(status):
                conn.close()
                return True

        except (HTTPException, socket.timeout, socket.error):
            return False
370516
public boolean connectIfNeeded() {
        if (getDDP().getState() == CONNSTATE.Disconnected) {
            // make connection to Meteor server
            getDDP().connect();
            return true;
        } else if (getDDP().getState() == CONNSTATE.Closed) {
           // try to reconnect w/ a new connection
            createDDPClient();
            getDDP().connect();
        }
        return false;
    }
587460
def has_connection(cls, pid, connection):
        
        with cls._lock:
            cls._ensure_pool_exists(pid)
            return connection in cls._pools[pid]
661244
def is_successful(self, retry=False):
        

        if not self.is_terminated(retry=retry):
            return False
        retry_num = options.retry_times
        while retry_num > 0:
            try:
                statuses = self.get_task_statuses()
                return all(task.status == Instance.Task.TaskStatus.SUCCESS
                           for task in statuses.values())
            except (errors.InternalServerError, errors.RequestTimeTooSkewed):
                retry_num -= 1
                if not retry or retry_num <= 0:
                    raise
1283663
def connected(self):
        
        node_list = self.node_list()
        for node in node_list:
            bfs_list = self.forw_bfs(node)
            if len(bfs_list) != len(node_list):
                return False
        return True
116749
def _do_tcp_check(self, ip, results):
        
        try:
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sock.settimeout(1)
            sock.connect((ip, self.conf['tcp_check_port']))
        except:
            # Any problem during the connection attempt? We won't diagnose it,
            # we just indicate failure by adding the IP to the list
            results.append(ip)
        finally:
            sock.close()
351363
public boolean isConnectionStale() {
        if (lastUsedTime == 0)
            return false;

        long currentTime = System.currentTimeMillis();
        long timeSinceLastUse = currentTime - lastUsedTime;
        return (timeSinceLastUse > MAX_KEEPALIVE);
    }
602992
protected boolean _connect(long timeout) {
    log.debug("Attempting connection...");
    ConnectFuture connFuture = this.connector.connect(new InetSocketAddress(
        this.host, this.port));
    if (!connFuture.awaitUninterruptibly(timeout)) {
      log.warn("Unable to connect to world model after {}ms.",
          Long.valueOf(this.connectionTimeout));
      return false;
    }
    if (!connFuture.isConnected()) {
      log.debug("Failed to connect.");
      return false;
    }

    try {
      log.debug("Attempting connection to {}:{}.", this.host,
          Integer.valueOf(this.port));
      this.session = connFuture.getSession();
    } catch (RuntimeIoException ioe) {
      log.error(String.format(
          "Could not create session to World Model (C) %s:%d.", this.host,
          Integer.valueOf(this.port)), ioe);
      return false;
    }
    return true;
  }
861043
def connected?(klass)
      return false if Process.pid != @process_pid.get
      conn = self.retrieve_connection_pool(klass)
      conn && conn.connected?
    end
818890
def connect(self):
        
        if self.connected:
            return
        pk = self._pk
        if self.exists(pk=pk):
            self._connected = True
        else:
            self._pk = None
            self._connected = False
            raise DoesNotExist("No %s found with pk %s" % (self.__class__.__name__, pk))
350492
protected boolean checkConnection()
    {
        super.checkConnection();
        try
        {
            if (_jarConnection!=_connection)
                newConnection();
        }
        catch(IOException e)
        {
            LogSupport.ignore(log,e);
            _jarConnection=null;
        }
        
        return _jarConnection!=null;
    }
858316
def _did_receive_response(self, connection):
        

        if connection.has_timeouted:
            bambou_logger.info("NURESTConnection has timeout.")
            return

        has_callbacks = connection.has_callbacks()
        should_post = not has_callbacks

        if connection.handle_response_for_connection(should_post=should_post) and has_callbacks:
            callback = connection.callbacks['local']
            callback(connection)