Beispiel #1
0
 /**
  * testRead method
  *
  * @return void
  */
 public function testRead()
 {
     $socket = new FileStreamSocket();
     $socket->connect(__DIR__ . '/../test_packets/connack_not_authorized.hex');
     $result = Packet::read($socket);
     $expected = pack('C*', 0x0, 0x5);
     $this->assertEquals($expected, $result->buffer());
 }
Beispiel #2
0
 /**
  * Creates a new FileSocket and sets it up to use a test packet
  * from the test_packets directory.
  *
  * @param string $packetName
  * @return FileStreamSocket
  */
 protected function createTestSocket($packetName)
 {
     $socket = new FileStreamSocket();
     $socket->connect(__DIR__ . sprintf('/test_packets/%s.hex', $packetName));
     return $socket;
 }