Skip to content

Commit e98491c

Browse files
author
Jerry Kuch
committed
Don't sleep in test and check shutdown signal more reasonably.
1 parent 26a9815 commit e98491c

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,17 @@ public void testTryPublishingToInternalExchange()
116116

117117
// Publishing to the internal exchange will not be allowed...
118118
channel.basicPublish("e1", "", null, testDataBody);
119-
Thread.sleep(250L);
120-
assertFalse(channel.isOpen());
121-
ShutdownSignalException sdse = channel.getCloseReason();
122-
assertNotNull(sdse);
123-
String message = sdse.getMessage();
124-
assertTrue(message.contains("reply-code=403"));
125-
assertTrue(message.contains("reply-text=ACCESS_REFUSED"));
126-
assertTrue(message.contains("cannot publish to internal exchange"));
119+
try
120+
{
121+
// This blocking operation will fail because our bad attempt to
122+
// to the internal exchange...
123+
channel.basicGet("q1", true);
124+
fail("Channel should have shut down with 403 (access refused).");
125+
}
126+
catch (IOException e)
127+
{
128+
// We should get 403, access refused...
129+
checkShutdownSignal(403, e);
130+
}
127131
}
128-
129132
}

0 commit comments

Comments
 (0)