Esempio n. 1
0
 /**
  * @param $command
  * @param array $arguments
  * @return mixed
  * @throws ConnectionException
  * @throws ResponseException
  * @throws TransportException
  */
 protected function send($command, $arguments = array())
 {
     if (!$this->isConnected) {
         $this->connect();
     }
     $request = $this->serializer->serialize($command, $arguments);
     $result = fwrite($this->stream, $request);
     if ($result === false) {
         throw new TransportException("Unable to send command to node {$this->nodeId}");
     }
     $response = $this->responseReader->getResponse($this->stream);
     return $response;
 }
Esempio n. 2
0
 /**
  * @param string $command
  * @param array $arguments
  * @param string $expected
  * @dataProvider dataTestSerialize
  */
 public function testSerialize($command, array $arguments, $expected)
 {
     $this->assertEquals($expected, $this->service->serialize($command, $arguments));
 }