public function connect($ariAddress, $amiAddress = null, $streamOptions = [], $clientOptions = [])
    {
        $this->ariClient->connect($ariAddress, $streamOptions, $clientOptions);
        $this->wsClient = $this->ariClient->getWsClient();
        $this->stasisApplicationName = $this->ariClient->getStasisApplicationName();

        if ($amiAddress !== null) {
            $this->amiClient = new AmiClient($this->ariClient->getWsClient(), $this->eventLoop, $this->logger);
            $this->amiClient
                ->connect($amiAddress)
                ->done();
        }
    }