public function testSendAndReceiveByteMessage() { $frame = new Frame(); $frame->setCommand('testing'); $frame->setHeader('testing', 1); $frame->setBody('hello ' . Frame::END_OF_FRAME . ' world'); $client = new Client(); $client->addConnection('tcp', 'localhost', '11232', '\\ZendQueueTest\\Stomp\\Mock'); $client->send($frame); $this->assertTrue($client->canRead()); $test = $client->receive(); $this->assertEquals('testing', $test->getCommand()); $this->assertEquals(1, $test->getHeader('testing')); $this->assertEquals('hello ' . Frame::END_OF_FRAME . ' world', $test->getBody()); }
public function testByteMessageAutoContentLengthOn() { $frame = new Frame(); $frame->setCommand('TESTING'); $frame->setAutoContentLength(true); $frame->setBody('hello ' . Frame::END_OF_FRAME . ' world'); $connection = new ConnectionSocketOverload(); $connection->setSocket($this->_socket); $connection->write($frame); rewind($this->_socket); $test = $connection->read(); $this->assertEquals('hello ' . Frame::END_OF_FRAME . ' world', $test->getBody()); }