Exemple #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;
 }
 /**
  * @param string $response
  * @param string $expected
  * @dataProvider dataTestGetResponse
  */
 public function testGetResponse($response, $expected)
 {
     $this->assertEquals($expected, $this->deserializer->getResponse($this->mockResource($response)));
 }