def test_write(self):
        npn_extension = NPNExtension().create()

        self.assertEqual(bytearray(
            b'\x33\x74' +   # type of extension - NPN
            b'\x00\x00'     # length of extension
            ), npn_extension.write())
Beispiel #2
0
    def test_write(self):
        npn_extension = NPNExtension().create()

        self.assertEqual(
            bytearray(b'\x33\x74' +  # type of extension - NPN
                      b'\x00\x00'  # length of extension
                      ),
            npn_extension.write())
    def test_write_with_list(self):
        npn_extension = NPNExtension()
        npn_extensnio = npn_extension.create([
            bytearray(b'http/1.1'),
            bytearray(b'spdy/3')])

        self.assertEqual(bytearray(
            b'\x33\x74' +   # type of extension - NPN
            b'\x00\x10' +   # length of extension
            b'\x08' +       # length of name of protocol
            # utf-8 encoding of "http/1.1"
            b'\x68\x74\x74\x70\x2f\x31\x2e\x31' +
            b'\x06' +       # length of name of protocol
            # utf-8 encoding of "spdy/3"
            b'\x73\x70\x64\x79\x2f\x33'
            ), npn_extension.write())
Beispiel #4
0
    def test_write_with_list(self):
        npn_extension = NPNExtension()
        npn_extensnio = npn_extension.create(
            [bytearray(b'http/1.1'),
             bytearray(b'spdy/3')])

        self.assertEqual(
            bytearray(b'\x33\x74' +  # type of extension - NPN
                      b'\x00\x10' +  # length of extension
                      b'\x08' +  # length of name of protocol
                      # utf-8 encoding of "http/1.1"
                      b'\x68\x74\x74\x70\x2f\x31\x2e\x31' +
                      b'\x06' +  # length of name of protocol
                      # utf-8 encoding of "spdy/3"
                      b'\x73\x70\x64\x79\x2f\x33'),
            npn_extension.write())