@@ -95,11 +95,14 @@ public void configure(SSLEngine sslEngine) throws IOException {
9595 }
9696 }
9797
98- @ Test public void largeMessage () throws Exception {
99- CountDownLatch latch = new CountDownLatch (1 );
100- connection = basicGetBasicConsume (connection , "tls.nio.queue" , latch , 1 * 1000 * 1000 );
101- boolean messagesReceived = latch .await (5 , TimeUnit .SECONDS );
102- assertTrue ("Message has not been received" , messagesReceived );
98+ @ Test public void messageSize () throws Exception {
99+ int [] sizes = new int [] {100 , 1000 , 10 * 1000 , 1 * 1000 * 1000 , 5 * 1000 * 1000 };
100+ for (int size : sizes ) {
101+ CountDownLatch latch = new CountDownLatch (1 );
102+ connection = basicGetBasicConsume (connection , "tls.nio.queue" , latch , size );
103+ boolean messagesReceived = latch .await (5 , TimeUnit .SECONDS );
104+ assertTrue ("Message has not been received" , messagesReceived );
105+ }
103106 }
104107
105108 private Connection basicGetBasicConsume (Connection connection , String queue , final CountDownLatch latch , int msgSize )
@@ -116,6 +119,7 @@ private Connection basicGetBasicConsume(Connection connection, String queue, fin
116119 public void handleDelivery (String consumerTag , Envelope envelope , AMQP .BasicProperties properties , byte [] body ) throws IOException {
117120 getChannel ().basicAck (envelope .getDeliveryTag (), false );
118121 latch .countDown ();
122+ getChannel ().basicCancel (consumerTag );
119123 }
120124 });
121125
0 commit comments