Ejemplo n.º 1
0
 def start(self, version_major, version_minor, server_properties,
             mechanisms, locales):
     args = AMQPWriter()
     args.write_octet(version_major)
     args.write_octet(version_minor)
     args.write_table(server_properties)
     args.write_longstr(' '.join(mechanisms))
     args.write_longstr(' '.join(locales))
     self._send_channel_method_frame(0, (10, 10), args)
Ejemplo n.º 2
0
    def test_octet(self):
        for val in range(256):
            w = AMQPWriter()
            w.write_octet(val)
            s = w.getvalue()
            self.assertEqualBinary(s, chr(val))

            r = AMQPReader(s)
            self.assertEqual(r.read_octet(), val)
Ejemplo n.º 3
0
    def test_multiple_bits2(self):
        """
        Check bits mixed with non-bits
        """
        w = AMQPWriter()
        w.write_bit(True)
        w.write_bit(True)
        w.write_bit(False)
        w.write_octet(10)
        w.write_bit(True)
        s = w.getvalue()

        self.assertEqualBinary(s, '\x03\x0a\x01')

        r = AMQPReader(s)
        self.assertEqual(r.read_bit(), True)
        self.assertEqual(r.read_bit(), True)
        self.assertEqual(r.read_bit(), False)
        self.assertEqual(r.read_octet(), 10)
        self.assertEqual(r.read_bit(), True)