Skip to content

Commit 481cb90

Browse files
author
Simon MacMullen
committed
Add test case.
1 parent e7f9a91 commit 481cb90

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.rabbitmq.client.test.functional;
2+
3+
import com.rabbitmq.client.AMQP;
4+
import com.rabbitmq.client.DefaultConsumer;
5+
import com.rabbitmq.client.Envelope;
6+
import com.rabbitmq.client.test.BrokerTestCase;
7+
8+
import java.io.IOException;
9+
10+
/**
11+
* Test that channel flow applies even when there are as yet no consumers.
12+
*/
13+
public class ChannelFlowNoConsumersTest extends BrokerTestCase {
14+
public void test() throws Exception {
15+
String q = channel.queueDeclare("", false, true, false, null).getQueue();
16+
basicPublishVolatile(q);
17+
channel.flow(false);
18+
String tag = channel.basicConsume(q, new DefaultConsumer(channel) {
19+
@Override
20+
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
21+
throw new IOException("Message received after channel flow.");
22+
}
23+
});
24+
25+
Thread.sleep(1000);
26+
channel.basicCancel(tag);
27+
}
28+
}

test/src/com/rabbitmq/client/test/functional/FunctionalTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public static TestSuite suite() {
6767
suite.addTestSuite(UnbindAutoDeleteExchange.class);
6868
suite.addTestSuite(RecoverAfterCancel.class);
6969
suite.addTestSuite(UnexpectedFrames.class);
70+
suite.addTestSuite(ChannelFlowNoConsumersTest.class);
7071
return suite;
7172
}
7273
}

0 commit comments

Comments
 (0)