close Connection
344764
public void close() {
        if (connected.compareAndSet(true, false)) {
            // remove handshake flag
            session.removeAttribute(Constants.HANDSHAKE_COMPLETE);
            // clear the delay queue
            queue.clear();
            // whether to attempt a nice close or a forceful one
            if (WebSocketTransport.isNiceClose()) {
                // send a proper ws close
                Packet packet = Packet.build(Constants.CLOSE_MESSAGE_BYTES, MessageType.CLOSE);
                WriteFuture writeFuture = session.write(packet);
                writeFuture.addListener(new IoFutureListener<WriteFuture>() {

                    @Override
                    public void operationComplete(WriteFuture future) {
                        if (future.isWritten()) {
                            log.debug("Close message written");
                            // only set on success for now to skip boolean check later
                            session.setAttribute(Constants.STATUS_CLOSE_WRITTEN, Boolean.TRUE);
                        }
                        future.removeListener(this);
                    }

                });
                // adjust close routine to allow for flushing
                CloseFuture closeFuture = session.closeOnFlush();
                closeFuture.addListener(new IoFutureListener<CloseFuture>() {

                    public void operationComplete(CloseFuture future) {
                        if (future.isClosed()) {
                            log.debug("Connection is closed");
                        } else {
                            log.debug("Connection is not yet closed");
                        }
                        future.removeListener(this);
                    }

                });
            } else {
                // force close
                CloseFuture closeFuture = session.closeNow();
                closeFuture.addListener(new IoFutureListener<CloseFuture>() {

                    public void operationComplete(CloseFuture future) {
                        if (future.isClosed()) {
                            log.debug("Connection is closed");
                        } else {
                            log.debug("Connection is not yet closed");
                        }
                        future.removeListener(this);
                    }

                });
            }
        }
    }
68769
def remove_connection(self, connection):
        """"""
        if not self._closing:
            self.connections.remove(connection)
            logger.debug("removed connection")
1357279
def close(self):
        
        LOGGER.debug('Connection Closing')
        if not self.is_closed:
            self.set_state(self.CLOSING)
        self.heartbeat.stop()
        try:
            if not self.is_closed and self.socket:
                self._channel0.send_close_connection()
                self._wait_for_connection_state(state=Stateful.CLOSED)
        except AMQPConnectionError:
            pass
        finally:
            self._close_remaining_channels()
            self._io.close()
            self.set_state(self.CLOSED)
        LOGGER.debug('Connection Closed')
986096
def close(self):
        """"""

        if self.hwman.stream.connected:
            self.hwman.disconnect()

        self.hwman.close()
        self.opened = False
884368
def close(self, wait=True, abort=False):
        """"""
        if not self.closed and not self.closing:
            self.closing = True
            self.server._trigger_event('disconnect', self.sid, run_async=False)
            if not abort:
                self.send(packet.Packet(packet.CLOSE))
            self.closed = True
            self.queue.put(None)
            if wait:
                self.queue.join()
55335
def close(self):
        
        NetworkTables.removeGlobalListener(self._nt_on_change)
        NetworkTables.removeConnectionListener(self._nt_connected)
1096811
def disconnect(self):
    """"""
    if self.sock is not None:
      try:
        self.sock.close()
      except socket.error:
        pass
      finally:
        self.sock = None
568724
def socket_close(self):
        """"""
        if self.sock != NC.INVALID_SOCKET:
            self.sock.close()
        self.sock = NC.INVALID_SOCKET
82449
def close(self):
        
        if not self._conn:
            raise psycopg2.InterfaceError('Connection not open')
        LOGGER.info('Closing connection %r in %s', self._conn, self.pid)
        self._pool_manager.free(self.pid, self._conn)
        self._pool_manager.remove_connection(self.pid, self._conn)

        # Un-assign the connection and cursor
        self._conn, self._cursor = None, None
104138
def close(self):
		
		self.cancel()
		self.logger.debug("Closing AMQP connection")
		try:
			self.connection.close()
		except Exception, eee:
			self.logger.warning("Received an error while trying to close AMQP connection: " + str(eee))
452469
def close_connection(self):
        
        if self.port:
            self.port.close()
            self.logger.debug("Close TCP port")
1321752
def close(self):
        """"""
        self.log.warning('Closing connection to AVR')
        self._closing = True
        if self.protocol.transport:
            self.protocol.transport.close()
812645
def close(self):
        """"""
        self._closed = True
        if self.receive_task:
            self.receive_task.cancel()
        if self.connection:
            self.connection.close()
661854
def close(self):
        """"""
        logger.debug('closing dongle, {} active connections'.format(len(self.conn_handles)))
        if self.is_scanning():
            logger.debug('in scanning mode, calling end_scan')
            self.end_scan()
        self.reset()
        if self.api is not None:
            self.api.stop_daemon()
            self.api = None
794026
def close(self):
        
        LOGGER.debug('Connection %s closing', self.id)
        if self.busy:
            raise ConnectionBusyError(self)
        with self._lock:
            if not self.handle.closed:
                try:
                    self.handle.close()
                except psycopg2.InterfaceError as error:
                    LOGGER.error('Error closing socket: %s', error)
1008511
def close_connection(self, connection, force=False):
        """"""
        if force:
            try:
                connection.close()
            except self.operational_exceptions:
                self.config.logger.error('ConnectionFactory - failed closing')
            for name, conn in self.pool.iteritems():
                if conn is connection:
                    break
            del self.pool[name]
        else:
            pass
51717
def close(self):
        '''  '''
        cache_key = self._cache_key()
        SSH_CONNECTION_CACHE.pop(cache_key, None)
        SFTP_CONNECTION_CACHE.pop(cache_key, None)
        if self.sftp is not None:
            self.sftp.close()
        self.ssh.close()