@@ -44,11 +44,15 @@ public void testSingleFrameDecoding() {
4444 ByteBuf incoming = Unpooled .buffer ();
4545 incoming .writeBytes (StompTestConstants .CONNECT_FRAME .getBytes ());
4646 channel .writeInbound (incoming );
47+
4748 StompHeadersSubframe frame = channel .readInbound ();
4849 assertNotNull (frame );
4950 assertEquals (StompCommand .CONNECT , frame .command ());
51+
5052 StompContentSubframe content = channel .readInbound ();
5153 assertSame (LastStompContentSubframe .EMPTY_LAST_CONTENT , content );
54+ content .release ();
55+
5256 Object o = channel .readInbound ();
5357 assertNull (o );
5458 }
@@ -58,13 +62,17 @@ public void testSingleFrameWithBodyAndContentLength() {
5862 ByteBuf incoming = Unpooled .buffer ();
5963 incoming .writeBytes (StompTestConstants .SEND_FRAME_2 .getBytes ());
6064 channel .writeInbound (incoming );
65+
6166 StompHeadersSubframe frame = channel .readInbound ();
6267 assertNotNull (frame );
6368 assertEquals (StompCommand .SEND , frame .command ());
69+
6470 StompContentSubframe content = channel .readInbound ();
6571 assertTrue (content instanceof LastStompContentSubframe );
6672 String s = content .content ().toString (CharsetUtil .UTF_8 );
6773 assertEquals ("hello, queue a!!!" , s );
74+ content .release ();
75+
6876 assertNull (channel .readInbound ());
6977 }
7078
@@ -73,13 +81,17 @@ public void testSingleFrameWithBodyWithoutContentLength() {
7381 ByteBuf incoming = Unpooled .buffer ();
7482 incoming .writeBytes (StompTestConstants .SEND_FRAME_1 .getBytes ());
7583 channel .writeInbound (incoming );
84+
7685 StompHeadersSubframe frame = channel .readInbound ();
7786 assertNotNull (frame );
7887 assertEquals (StompCommand .SEND , frame .command ());
88+
7989 StompContentSubframe content = channel .readInbound ();
8090 assertTrue (content instanceof LastStompContentSubframe );
8191 String s = content .content ().toString (CharsetUtil .UTF_8 );
8292 assertEquals ("hello, queue a!" , s );
93+ content .release ();
94+
8395 assertNull (channel .readInbound ());
8496 }
8597
@@ -90,24 +102,30 @@ public void testSingleFrameChunked() {
90102 ByteBuf incoming = Unpooled .buffer ();
91103 incoming .writeBytes (StompTestConstants .SEND_FRAME_2 .getBytes ());
92104 channel .writeInbound (incoming );
105+
93106 StompHeadersSubframe frame = channel .readInbound ();
94107 assertNotNull (frame );
95108 assertEquals (StompCommand .SEND , frame .command ());
109+
96110 StompContentSubframe content = channel .readInbound ();
97111 String s = content .content ().toString (CharsetUtil .UTF_8 );
98112 assertEquals ("hello" , s );
113+ content .release ();
99114
100115 content = channel .readInbound ();
101116 s = content .content ().toString (CharsetUtil .UTF_8 );
102117 assertEquals (", que" , s );
118+ content .release ();
103119
104120 content = channel .readInbound ();
105121 s = content .content ().toString (CharsetUtil .UTF_8 );
106122 assertEquals ("ue a!" , s );
123+ content .release ();
107124
108125 content = channel .readInbound ();
109126 s = content .content ().toString (CharsetUtil .UTF_8 );
110127 assertEquals ("!!" , s );
128+ content .release ();
111129
112130 assertNull (channel .readInbound ());
113131 }
@@ -122,14 +140,19 @@ public void testMultipleFramesDecoding() {
122140 StompHeadersSubframe frame = channel .readInbound ();
123141 assertNotNull (frame );
124142 assertEquals (StompCommand .CONNECT , frame .command ());
143+
125144 StompContentSubframe content = channel .readInbound ();
126145 assertSame (LastStompContentSubframe .EMPTY_LAST_CONTENT , content );
146+ content .release ();
127147
128148 StompHeadersSubframe frame2 = channel .readInbound ();
129149 assertNotNull (frame2 );
130150 assertEquals (StompCommand .CONNECTED , frame2 .command ());
151+
131152 StompContentSubframe content2 = channel .readInbound ();
132153 assertSame (LastStompContentSubframe .EMPTY_LAST_CONTENT , content2 );
154+ content2 .release ();
155+
133156 assertNull (channel .readInbound ());
134157 }
135158}
0 commit comments