コード例 #1
0
ファイル: test_hyper.py プロジェクト: ncarlson/hyper
    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\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
        )
コード例 #2
0
ファイル: test_hyper.py プロジェクト: 4honor/hyper
    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\x0D\x07\x00\x00\x00\x00\x00"
            + b"\x00\x00\x00\x40"  # Frame header
            + b"\x00\x00\x00\x20"  # Last Stream ID
            + b"hello"  # Error Code  # Additional data
        )
コード例 #3
0
ファイル: test_integration.py プロジェクト: zofuthan/hyper
        def socket_handler(listener):
            sock = listener.accept()[0]

            # We should get two packets: one connection header string, one
            # SettingsFrame. Rather than respond to the packets, send a GOAWAY
            # frame with error code 0 indicating clean shutdown.
            first = sock.recv(65535)
            second = sock.recv(65535)

            # Now, send the shut down.
            f = GoAwayFrame(0)
            f.error_code = 1
            sock.send(f.serialize())

            # Wait for the message from the main thread.
            sock.close()
            recv_event.wait()
コード例 #4
0
ファイル: test_hyper.py プロジェクト: lifuzu/hyper
    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\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
        )
コード例 #5
0
ファイル: test_hyper.py プロジェクト: lifuzu/hyper
    def test_go_away_has_no_flags(self):
        f = GoAwayFrame(0)
        flags = f.parse_flags(0xFF)

        assert not flags
        assert isinstance(flags, set)
コード例 #6
0
ファイル: test_hyper.py プロジェクト: ncarlson/hyper
    def test_go_away_has_no_flags(self):
        f = GoAwayFrame(0)
        flags = f.parse_flags(0xFF)

        assert not flags
        assert isinstance(flags, set)
コード例 #7
0
ファイル: test_hyper.py プロジェクト: ami-GS/hyper
 def test_goaway_frame_never_has_a_stream(self):
     with pytest.raises(ValueError):
         GoAwayFrame(1)