client->stop(); } public function testInit() { $this->client = AuthorAppMQTTClient::getInstance(); $this->client->setServer('202.200.18.22'); $this->client->setAppid('6N6QPV2FYD'); $this->client ->setClientId('6NEC8SKNK5') ->setUsername('6N6QPV2FYD') ->setPassword('123') ->registerEvent(AuthorAppMQTTClient::EVENT_CONNECT, function ($connection) { print_r('连接成功'); }); $result = $this->client->start(); self::assertTrue($result, '启动失败'); } }