1
1
/*
2
- * Copyright 2015-2022 the original author or authors.
2
+ * Copyright 2015-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
16
16
17
17
package io.rsocket.kotlin.frame
18
18
19
- import io.ktor.util.*
20
19
import io.ktor.utils.io.core.*
21
20
import io.rsocket.kotlin.payload.*
22
21
import io.rsocket.kotlin.test.*
@@ -30,13 +29,13 @@ class RequestStreamFrameTest : TestWithLeakCheck {
30
29
val frame = RequestStreamFrame (1 , 1 , payload(" d" , " md" ))
31
30
val bytes = frame.toPacketWithLength().readBytes()
32
31
33
- assertEquals(dump, hex( bytes))
32
+ assertEquals(dump, bytes.toHexString( ))
34
33
}
35
34
36
35
@Test
37
36
fun testDecoding () {
38
37
val dump = " 000010000000011900000000010000026d6464"
39
- val frame = packet(hex( dump)).toFrameWithLength()
38
+ val frame = packet(dump.hexToByteArray( )).toFrameWithLength()
40
39
41
40
assertTrue(frame is RequestFrame )
42
41
assertEquals(FrameType .RequestStream , frame.type)
@@ -55,13 +54,13 @@ class RequestStreamFrameTest : TestWithLeakCheck {
55
54
val frame = RequestStreamFrame (1 , 1 , Payload (packet(" d" ), ByteReadPacket .Empty ))
56
55
val bytes = frame.toPacketWithLength().readBytes()
57
56
58
- assertEquals(dump, hex( bytes))
57
+ assertEquals(dump, bytes.toHexString( ))
59
58
}
60
59
61
60
@Test
62
61
fun testDecodingWithEmptyMetadata () {
63
62
val dump = " 00000e0000000119000000000100000064"
64
- val frame = packet(hex( dump)).toFrameWithLength()
63
+ val frame = packet(dump.hexToByteArray( )).toFrameWithLength()
65
64
66
65
assertTrue(frame is RequestFrame )
67
66
assertEquals(FrameType .RequestStream , frame.type)
@@ -80,13 +79,13 @@ class RequestStreamFrameTest : TestWithLeakCheck {
80
79
val frame = RequestStreamFrame (1 , 1 , payload(" d" ))
81
80
val bytes = frame.toPacketWithLength().readBytes()
82
81
83
- assertEquals(dump, hex( bytes))
82
+ assertEquals(dump, bytes.toHexString( ))
84
83
}
85
84
86
85
@Test
87
86
fun testDecodingWithNullMetadata () {
88
87
val dump = " 00000b0000000118000000000164"
89
- val frame = packet(hex( dump)).toFrameWithLength()
88
+ val frame = packet(dump.hexToByteArray( )).toFrameWithLength()
90
89
91
90
assertTrue(frame is RequestFrame )
92
91
assertEquals(FrameType .RequestStream , frame.type)
0 commit comments