Skip to content

Commit 57b0792

Browse files
More robust confirm listener recovery test
1 parent 077eb1d commit 57b0792

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ public void handleReturn(int replyCode, String replyText, String exchange,
112112
}
113113

114114
public void testConfirmListenerRecovery() throws IOException, InterruptedException, TimeoutException {
115-
int n = 10;
116-
String q = channel.queueDeclare(UUID.randomUUID().toString(), false, false, false, null).getQueue();
115+
int n = 3;
117116
final CountDownLatch latch = new CountDownLatch(n);
118117
channel.addConfirmListener(new ConfirmListener() {
119118
@Override
@@ -123,16 +122,18 @@ public void handleAck(long deliveryTag, boolean multiple) throws IOException {
123122

124123
@Override
125124
public void handleNack(long deliveryTag, boolean multiple) throws IOException {
125+
latch.countDown();
126126
}
127127
});
128-
channel.confirmSelect();
128+
String q = channel.queueDeclare(UUID.randomUUID().toString(), false, false, false, null).getQueue();
129129
closeAndWaitForShutdown(connection);
130130
waitForRecovery();
131131
expectChannelRecovery(channel);
132-
for (int i = 0; i < n; i++) {
132+
channel.confirmSelect();
133+
for (int i = 0; i < n * 20; i++) {
133134
channel.basicPublish("", q, true, false, null, "mandatory1".getBytes());
134135
}
135-
channel.waitForConfirms(200);
136+
channel.waitForConfirms(300);
136137
assertTrue(latch.await(50, TimeUnit.MILLISECONDS));
137138
}
138139

0 commit comments

Comments
 (0)