private function cancelRequest()
    {
        if ($this->currentCommand !== null) {
            $this->socket->connect($this->uri)->then(function (DuplexStreamInterface $conn) {
                $cancelRequest = new CancelRequest($this->backendKeyData->getPid(), $this->backendKeyData->getKey());
                $conn->end($cancelRequest->encodedMessage());
            }, function (\Throwable $e) {
                $this->debug("Error connecting for cancellation... " . $e->getMessage() . "\n");
            });
        }
    }