Пример #1
0
 public function testSendError()
 {
     list($client1, $client2) = $this->sendGenTestDataDefault();
     // Error
     $raw = $client1->sendError();
     $json = $this->rawMsgToJson($raw);
     $this->assertEquals('error', $json[0]['name']);
     $this->assertEquals(9999, $json[0]['data']['code']);
     $errors = Client::getError();
     foreach ($errors as $errorCode => $error) {
         $raw = $client1->sendError($errorCode);
         $json = $this->rawMsgToJson($raw);
         #ve($json);
         $this->assertEquals('error', $json[0]['name']);
         $this->assertEquals($errorCode, $json[0]['data']['code']);
     }
     $client1->getServer()->getKernel()->shutdown();
     $client2->getServer()->getKernel()->shutdown();
 }
Пример #2
0
 private function clientRemove(Client $client)
 {
     $this->log->debug('client remove: ' . $client->getId());
     if ($client->getStatus('isChannelLocal') || $client->getStatus('isChannelPeer')) {
         $this->consoleSetModeChannel(false);
         $this->consoleSetModeChannelClient(null);
         #$this->consoleMsgAdd();
         $this->consoleMsgAdd('Connection to ' . $client->getUri() . ' closed.', true, true, true);
     }
     $client->shutdown();
     $this->getKernel()->incSettingsTrafficIn($client->resetTrafficIn());
     $this->getKernel()->incSettingsTrafficOut($client->resetTrafficOut());
     $clientsId = $client->getId();
     unset($this->clients[$clientsId]);
 }
Пример #3
0
 public function __construct()
 {
     parent::__construct();
     $this->uri = UriFactory::factory('http://');
 }
Пример #4
0
 /**
  * @codeCoverageIgnore
  */
 public function dataSend($data)
 {
     $msg = parent::dataSend($data);
     if ($msg && $this->getSocket()) {
         $this->getSocket()->write($msg);
     }
     return $msg;
 }