@@ -40,6 +40,7 @@ public void openConnection()
4040 throws IOException , TimeoutException {
4141 try {
4242 connectionFactory .useSslProtocol ();
43+ connectionFactory .useNio ();
4344 } catch (Exception ex ) {
4445 throw new IOException (ex .toString ());
4546 }
@@ -55,15 +56,15 @@ public void openConnection()
5556 }
5657 }
5758 if (connection == null ) {
58- fail ("Couldn't open TLS connection after 3 attemps " );
59+ fail ("Couldn't open TLS connection after 3 attempts " );
5960 }
6061
6162 }
6263
6364 @ Test
6465 public void connectionGetConsume () throws Exception {
6566 CountDownLatch latch = new CountDownLatch (1 );
66- connection = basicGetBasicConsume (connection , "tls.nio.queue" , latch );
67+ connection = basicGetBasicConsume (connection , "tls.nio.queue" , latch , 100 * 1000 );
6768 boolean messagesReceived = latch .await (5 , TimeUnit .SECONDS );
6869 assertTrue ("Message has not been received" , messagesReceived );
6970 }
@@ -94,13 +95,20 @@ public void configure(SSLEngine sslEngine) throws IOException {
9495 }
9596 }
9697
97- private Connection basicGetBasicConsume (Connection connection , String queue , final CountDownLatch latch )
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 );
103+ }
104+
105+ private Connection basicGetBasicConsume (Connection connection , String queue , final CountDownLatch latch , int msgSize )
98106 throws IOException , TimeoutException {
99107 Channel channel = connection .createChannel ();
100108 channel .queueDeclare (queue , false , false , false , null );
101109 channel .queuePurge (queue );
102110
103- channel .basicPublish ("" , queue , null , new byte [100 * 1000 ]);
111+ channel .basicPublish ("" , queue , null , new byte [msgSize ]);
104112
105113 channel .basicConsume (queue , false , new DefaultConsumer (channel ) {
106114
0 commit comments