Disconnect and stop the event loop
@return \React\Promise\Promise|\React\Promise\PromiseInterface
11097
public function stop()
    {
        $deferred = new Deferred();

        $onStop = $this->onStop;
        $onStop()
            ->then(function () use (&$deferred) {
                $this->ariClient->onClose(function () use (&$deferred) {
                    $this->eventLoop->stop();
                    $deferred->resolve();
                });
                $this->wsClient->close();
            });

        return $deferred->promise();
    }
937477
public function cancel()
    {
        if (!isset($this->_links->self->href)) {
            return $this;
        }

        $body = null;
        if($this->client->usesOAuth()) {
            $body = json_encode([
                "testmode" => $this->mode === "test" ? true : false
            ]);
        }

        $result = $this->client->performHttpCallToFullUrl(
            MollieApiClient::HTTP_DELETE,
            $this->_links->self->href,
            $body
        );

        return ResourceFactory::createFromApiResult($result, new Subscription($this->client));
    }
737486
public function disconnect()
    {
        if ($this->_isValidService()) {
            $this->getService()->quit();
            $this->_service = null;
            $this->_connected = false;
        }

        return $this;
    }
339257
function stop() {
  return new Promise((resolve) => {
    if (child && child.kill) {
      debug('stopping test server');
      child.kill('SIGTERM');
      process.removeListener('exit', stop);
      child = null;
      debug('stopped test server');
    }

    resolve();
  });
}
376415
private static function stop(): Promise
    {
        return call(function () {
            list($exceptions) = yield self::terminate();

            if (!empty($exceptions)) {
                $exception = new MultiReasonException($exceptions);
                $message = \implode('; ', \array_map(function (\Throwable $exception): string {
                    return $exception->getMessage();
                }, $exceptions));
                throw new ClusterException("Stopping failed: " . $message, 0, $exception);
            }
        });
    }
1229950
function() {
      return new Promise((resolve) => {
        log.debug(`Destroy called on queue ${this.name} - ${connection.name} (${this.channel.getMessageCount()} messages pending)`);
        this.on('destroyed', () => {
          this.subscriptions = [];
          resolve();
        }).once();
        this.handle('destroy');
      });
    }
367966
public function disconnect()
	{
		if (is_resource($this->_hSocket)) {
			$this->_log('INFO: Disconnected.');
			return fclose($this->_hSocket);
		}
		return false;
	}
906257
function unpin() {
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) {
            $this->client->apimanager()->endpoints->channel->unpinChannelMessage($this->channel->getId(), $this->id)->done(function () use ($resolve) {
                $resolve($this);
            }, $reject);
        }));
    }
541583
public function disconnect()
    {
        if ($this->pdo instanceof \PDO) {
            $this->pdo = null;

            $disconnected = true;
        } else {
            $disconnected = false;
        }

        return $disconnected;
    }
499555
public function detach()
    {
        $this->calendar->getEvents()->removeEvent($this);
        $this->calendar = null;

        return $this;
    }
1175510
public function pause()
    {
        $deferred = new Deferred();

        if (! $this->speaking) {
            $deferred->reject(new \Exception('Audio must be playing to pause it.'));

            return $deferred->promise();
        }

        $this->isPaused = true;
        $deferred->resolve();

        return $deferred->promise();
    }
511761
public function stop()
    {

        // start application shutdown
        $this->synchronized(function ($self) {
            $self->applicationState = ApplicationStateKeys::get(ApplicationStateKeys::HALT);
        }, $this);

        do {
            // log a message that we'll wait till application has been shutdown
            \info(sprintf('Wait for application %s to be shutdown', $this->getName()));

            // query whether application state key is SHUTDOWN or not
            $waitForShutdown = $this->synchronized(function ($self) {
                return $self->applicationState->notEquals(ApplicationStateKeys::get(ApplicationStateKeys::SHUTDOWN));
            }, $this);

            // wait one second more
            sleep(1);

        } while ($waitForShutdown);
    }
589408
public function disconnect()
    {
        if ($this->socket) {
            $this->send('LOGOUT');

            fclose($this->socket);

            $this->socket = null;
        }

        return $this;
    }
888509
public function shutdown(): NetworkInterface
    {
        foreach ($this->processes as $process) {
            $process[self::COMPONENT]->shutdown();
        }

        // explicitly destroy the $connections
        foreach ($this->connections as $connection) {
            $connection = null;
        }

        $this->graph = null;
        $this->processes = [];
        $this->startupDate = null;
        $this->connections = [];

        return $this;
    }
78667
public function stop()
    {
        $this->endTime = microtime(true);
        $this->endMemory = memory_get_peak_usage(true);

        return $this;
    }
78213
protected Promise disconnect() {
		int s = status.get();
		if (s != STATUS_DISCONNECTED && s != STATUS_DISCONNECTING) {
			status.set(STATUS_DISCONNECTING);
			if (clientSub != null) {
				clientSub.disconnect();
			}
			if (clientPub != null) {
				clientPub.disconnect();
			}
			status.set(STATUS_DISCONNECTED);
		}
		return Promise.resolve();
	}
1063578
public function disconnect($replyCode = 0, $replyText = "")
    {
        if ($this->state === ClientStateEnum::DISCONNECTING) {
            return $this->disconnectPromise;
        }

        if ($this->state !== ClientStateEnum::CONNECTED) {
            return Promise\reject(new ClientException("Client is not connected."));
        }

        $this->state = ClientStateEnum::DISCONNECTING;

        $promises = [];

        if ($replyCode === 0) {
            foreach ($this->channels as $channel) {
                $promises[] = $channel->close();
            }
        }

        return $this->disconnectPromise = Promise\all($promises)->then(function () use ($replyCode, $replyText) {
            if (!empty($this->channels)) {
                throw new \LogicException("All channels have to be closed by now.");
            }

            $this->connectionClose($replyCode, $replyText, 0, 0);
            $this->closeStream();
            $this->init();
            return $this;
        });
    }