public function next(Packet $packet) { /** @var ConnectResponsePacket $packet */ if ($packet->isSuccess()) { $this->succeed($this->connection); } else { $this->fail($packet->getErrorName()); } }