expectException(ConnectingToBrokerFailedException::class); $this->expectExceptionCode(ConnectingToBrokerFailedException::EXCEPTION_CONNECTION_SOCKET_ERROR); try { $client->connect(null, true); } catch (ConnectingToBrokerFailedException $e) { $this->assertGreaterThan(0, $e->getConnectionErrorCode()); $this->assertNotEmpty($e->getConnectionErrorMessage()); throw $e; } } }