@@ -224,10 +224,53 @@ public void headerAndDataFramesShouldBeDelivered() {
224224
225225 @ Test
226226 public void headerMultipleContentLengthValidationShouldPropagate () {
227+ headerMultipleContentLengthValidationShouldPropagate (false );
228+ }
229+
230+ @ Test
231+ public void headerMultipleContentLengthValidationShouldPropagateWithEndStream () {
232+ headerMultipleContentLengthValidationShouldPropagate (true );
233+ }
234+
235+ private void headerMultipleContentLengthValidationShouldPropagate (boolean endStream ) {
227236 LastInboundHandler inboundHandler = new LastInboundHandler ();
228237 request .addLong (HttpHeaderNames .CONTENT_LENGTH , 0 );
229238 request .addLong (HttpHeaderNames .CONTENT_LENGTH , 1 );
230- Http2StreamChannel channel = newInboundStream (3 , false , inboundHandler );
239+ Http2StreamChannel channel = newInboundStream (3 , endStream , inboundHandler );
240+ try {
241+ inboundHandler .checkException ();
242+ fail ();
243+ } catch (Exception e ) {
244+ assertThat (e , CoreMatchers .<Exception >instanceOf (StreamException .class ));
245+ }
246+ assertNull (inboundHandler .readInbound ());
247+ assertFalse (channel .isActive ());
248+ }
249+
250+ @ Test
251+ public void headerPlusSignContentLengthValidationShouldPropagate () {
252+ headerSignContentLengthValidationShouldPropagateWithEndStream (false , false );
253+ }
254+
255+ @ Test
256+ public void headerPlusSignContentLengthValidationShouldPropagateWithEndStream () {
257+ headerSignContentLengthValidationShouldPropagateWithEndStream (false , true );
258+ }
259+
260+ @ Test
261+ public void headerMinusSignContentLengthValidationShouldPropagate () {
262+ headerSignContentLengthValidationShouldPropagateWithEndStream (true , false );
263+ }
264+
265+ @ Test
266+ public void headerMinusSignContentLengthValidationShouldPropagateWithEndStream () {
267+ headerSignContentLengthValidationShouldPropagateWithEndStream (true , true );
268+ }
269+
270+ private void headerSignContentLengthValidationShouldPropagateWithEndStream (boolean minus , boolean endStream ) {
271+ LastInboundHandler inboundHandler = new LastInboundHandler ();
272+ request .add (HttpHeaderNames .CONTENT_LENGTH , (minus ? "-" : "+" ) + 1 );
273+ Http2StreamChannel channel = newInboundStream (3 , endStream , inboundHandler );
231274 try {
232275 inboundHandler .checkException ();
233276 fail ();
0 commit comments