27
27
28
28
import static org .junit .Assert .*;
29
29
30
-
31
30
/**
32
- * Unit tests for {@link BufferingStompDecoder}..
31
+ * Unit tests for {@link BufferingStompDecoder}.
33
32
*
34
33
* @author Rossen Stoyanchev
35
34
* @since 4.0.3
@@ -38,9 +37,9 @@ public class BufferingStompDecoderTests {
38
37
39
38
private final StompDecoder STOMP_DECODER = new StompDecoder ();
40
39
40
+
41
41
@ Test
42
42
public void basic () throws InterruptedException {
43
-
44
43
BufferingStompDecoder stompDecoder = new BufferingStompDecoder (STOMP_DECODER , 128 );
45
44
String chunk = "SEND\n a:alpha\n \n Message body\0 " ;
46
45
@@ -54,7 +53,6 @@ public void basic() throws InterruptedException {
54
53
55
54
@ Test
56
55
public void oneMessageInTwoChunks () throws InterruptedException {
57
-
58
56
BufferingStompDecoder stompDecoder = new BufferingStompDecoder (STOMP_DECODER , 128 );
59
57
String chunk1 = "SEND\n a:alpha\n \n Message" ;
60
58
String chunk2 = " body\0 " ;
@@ -72,7 +70,6 @@ public void oneMessageInTwoChunks() throws InterruptedException {
72
70
73
71
@ Test
74
72
public void twoMessagesInOneChunk () throws InterruptedException {
75
-
76
73
BufferingStompDecoder stompDecoder = new BufferingStompDecoder (STOMP_DECODER , 128 );
77
74
String chunk = "SEND\n a:alpha\n \n Payload1\0 " + "SEND\n a:alpha\n \n Payload2\0 " ;
78
75
List <Message <byte []>> messages = stompDecoder .decode (toByteBuffer (chunk ));
@@ -87,10 +84,8 @@ public void twoMessagesInOneChunk() throws InterruptedException {
87
84
88
85
@ Test
89
86
public void oneFullAndOneSplitMessageContentLength () throws InterruptedException {
90
-
91
- int contentLength = "Payload2a-Payload2b" .getBytes ().length ;
92
-
93
87
BufferingStompDecoder stompDecoder = new BufferingStompDecoder (STOMP_DECODER , 128 );
88
+ int contentLength = "Payload2a-Payload2b" .getBytes ().length ;
94
89
String chunk1 = "SEND\n a:alpha\n \n Payload1\0 SEND\n content-length:" + contentLength + "\n " ;
95
90
List <Message <byte []>> messages = stompDecoder .decode (toByteBuffer (chunk1 ));
96
91
@@ -118,7 +113,6 @@ public void oneFullAndOneSplitMessageContentLength() throws InterruptedException
118
113
119
114
@ Test
120
115
public void oneFullAndOneSplitMessageNoContentLength () throws InterruptedException {
121
-
122
116
BufferingStompDecoder stompDecoder = new BufferingStompDecoder (STOMP_DECODER , 128 );
123
117
String chunk1 = "SEND\n a:alpha\n \n Payload1\0 SEND\n a:alpha\n " ;
124
118
List <Message <byte []>> messages = stompDecoder .decode (toByteBuffer (chunk1 ));
@@ -147,7 +141,6 @@ public void oneFullAndOneSplitMessageNoContentLength() throws InterruptedExcepti
147
141
148
142
@ Test
149
143
public void oneFullAndOneSplitWithContentLengthExceedingBufferSize () throws InterruptedException {
150
-
151
144
BufferingStompDecoder stompDecoder = new BufferingStompDecoder (STOMP_DECODER , 128 );
152
145
String chunk1 = "SEND\n a:alpha\n \n Payload1\0 SEND\n content-length:129\n " ;
153
146
List <Message <byte []>> messages = stompDecoder .decode (toByteBuffer (chunk1 ));
@@ -169,24 +162,23 @@ public void oneFullAndOneSplitWithContentLengthExceedingBufferSize() throws Inte
169
162
}
170
163
171
164
@ Test (expected = StompConversionException .class )
172
- public void bufferSizeLimit () throws InterruptedException {
165
+ public void bufferSizeLimit () {
173
166
BufferingStompDecoder stompDecoder = new BufferingStompDecoder (STOMP_DECODER , 10 );
174
167
String payload = "SEND\n a:alpha\n \n Message body" ;
175
168
stompDecoder .decode (toByteBuffer (payload ));
176
169
}
177
170
178
171
@ Test
179
- public void incompleteCommand () throws InterruptedException {
180
-
172
+ public void incompleteCommand () {
181
173
BufferingStompDecoder stompDecoder = new BufferingStompDecoder (STOMP_DECODER , 128 );
182
174
String chunk = "MESSAG" ;
183
175
184
176
List <Message <byte []>> messages = stompDecoder .decode (toByteBuffer (chunk ));
185
177
assertEquals (0 , messages .size ());
186
178
}
187
179
188
- @ Test (expected = StompConversionException .class ) // SPR-12418
189
- public void endingBackslashHeaderValueCheck () throws InterruptedException {
180
+ @ Test (expected = StompConversionException .class ) // SPR-12418
181
+ public void endingBackslashHeaderValueCheck () {
190
182
BufferingStompDecoder stompDecoder = new BufferingStompDecoder (STOMP_DECODER , 128 );
191
183
String payload = "SEND\n a:alpha\\ \n \n Message body\0 " ;
192
184
stompDecoder .decode (toByteBuffer (payload ));
0 commit comments