Esempio n. 1
0
 def test_repr(self):
     f = GoAwayFrame()
     assert repr(f).endswith(
         "last_stream_id=0, error_code=0, additional_data=b''")
     f.last_stream_id = 64
     f.error_code = 32
     f.additional_data = b'hello'
     assert repr(f).endswith(
         "last_stream_id=64, error_code=32, additional_data=b'hello'")
 def build_goaway_frame(self,
                        last_stream_id,
                        error_code=0,
                        additional_data=b''):
     """
     Builds a single GOAWAY frame.
     """
     f = GoAwayFrame(0)
     f.error_code = error_code
     f.last_stream_id = last_stream_id
     f.additional_data = additional_data
     return f
Esempio n. 3
0
 def build_goaway_frame(self,
                        last_stream_id,
                        error_code=0,
                        additional_data=b''):
     """
     Builds a single GOAWAY frame.
     """
     f = GoAwayFrame(0)
     f.error_code = error_code
     f.last_stream_id = last_stream_id
     f.additional_data = additional_data
     return f
    def test_goaway_serializes_properly(self):
        f = GoAwayFrame(0)
        f.last_stream_id = 64
        f.error_code = 32
        f.additional_data = b'hello'

        s = f.serialize()
        assert s == (
            b'\x00\x00\x0D\x07\x00\x00\x00\x00\x00' +  # Frame header
            b'\x00\x00\x00\x40'                     +  # Last Stream ID
            b'\x00\x00\x00\x20'                     +  # Error Code
            b'hello'                                   # Additional data
        )
Esempio n. 5
0
    def test_goaway_serializes_properly(self):
        f = GoAwayFrame()
        f.last_stream_id = 64
        f.error_code = 32
        f.additional_data = b'hello'

        s = f.serialize()
        assert s == (
            b'\x00\x00\x0D\x07\x00\x00\x00\x00\x00' +  # Frame header
            b'\x00\x00\x00\x40' +  # Last Stream ID
            b'\x00\x00\x00\x20' +  # Error Code
            b'hello'  # Additional data
        )