Esempio n. 1
0
 public function testFrameInLegacyModeWontEncodeHeaders()
 {
     $frame = new Frame('SEND', ['my:var' => "\\multi\nline\r!"]);
     $frame->legacyMode(true);
     $result = $frame->__toString();
     $expected = "SEND\nmy:var:\\multi\\nline\r!\n\n";
     $this->assertEquals($expected, $result);
 }
Esempio n. 2
0
 /**
  * Write frame to server.
  *
  * @param Frame $stompFrame
  * @return boolean
  * @throws ConnectionException
  */
 public function writeFrame(Frame $stompFrame)
 {
     if (!$this->isConnected()) {
         throw new ConnectionException('Not connected to any server.', $this->activeHost);
     }
     $data = $stompFrame->__toString();
     if (!@fwrite($this->connection, $data, strlen($data))) {
         throw new ConnectionException('Was not possible to write frame!', $this->activeHost);
     }
     return true;
 }