Esempio n. 1
0
 /**
  * @expectedException RuntimeException
  */
 public function testInvalidSizeNotPositive()
 {
     $this->stream = fopen('php://temp', 'w+b');
     fwrite($this->stream, pack('N', 0));
     fwrite($this->stream, '');
     rewind($this->stream);
     $this->obj->readFrom($this->stream);
     $this->fail('The above call should throw an exception');
 }
Esempio n. 2
0
 /**
  * Get the response
  * 
  * @return array
  */
 protected function getResponse()
 {
     $response = new Kafka_BoundedByteBuffer_Receive();
     $response->readCompletely($this->conn);
     rewind($response->buffer);
     // this has the side effect of setting the initial position of buffer correctly
     $errorCode = array_shift(unpack('n', fread($response->buffer, 2)));
     //rewind($response->buffer);
     return array('response' => $response, 'errorCode' => $errorCode);
 }