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); }
/** * 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; }