Пример #1
0
    def test_wrong_version(self):
        # Just a header, just reading the invalid
        # number causes an exception.
        # Version = 99, type = 1 len= 5
        msg = six.b('c\x01\x00\x00\x00\x00\x00\x05')
        s, stream = self._with_data(msg)

        c = Connection(s)

        c.read_packet()
Пример #2
0
    def test_wrong_version(self):
        # Just a header, just reading the invalid
        # number causes an exception.
        # Version = 99, type = 1 len= 5
        msg = six.b('c\x01\x00\x00\x00\x00\x00\x05')
        s, stream = self._with_data(msg)

        c = Connection(s)

        c.read_packet()
Пример #3
0
    def test_read_packet(self):
        s = self._socket()
        # Version = 1, type = 't', len = 31
        msg = self._dummy_msg

        s, stream = self._with_data(msg)

        c = Connection(s)

        kind, body = c.read_packet()

        eq_(kind, 116)
        eq_(body, "Hello World")
        eq_(stream.tell(), len(msg))
Пример #4
0
    def test_read_packet(self):
        s = self._socket()
        # Version = 1, type = 't', len = 31
        msg = self._dummy_msg

        s, stream = self._with_data(msg)

        c = Connection(s)

        kind, body = c.read_packet()

        eq_(kind, 116)
        eq_(body, "Hello World")
        eq_(stream.tell(), len(msg))