Skip to content

Commit a5ff08d

Browse files
author
Matthew Sackman
committed
Initial and obvious fix - cope with both possible outcomes in the test
1 parent 633caf0 commit a5ff08d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/src/com/rabbitmq/client/test/BrokenFramesTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,16 @@ public void testNoMethod() throws Exception {
7777
frames.add(new Frame(AMQP.FRAME_HEADER, 0));
7878
myFrameHandler.setFrames(frames.iterator());
7979

80+
AMQConnection conn = new AMQConnection(params, myFrameHandler);
8081
try {
81-
new AMQConnection(params, myFrameHandler).start(false);
82+
conn.start(false);
8283
} catch (IOException e) {
8384
UnexpectedFrameError unexpectedFrameError = findUnexpectedFrameError(e);
85+
if (null == unexpectedFrameError) {
86+
Throwable cause = conn.getCloseReason().getCause();
87+
unexpectedFrameError = (UnexpectedFrameError)
88+
(cause instanceof UnexpectedFrameError ? cause : null);
89+
}
8490
assertNotNull(unexpectedFrameError);
8591
assertEquals(AMQP.FRAME_HEADER, unexpectedFrameError.getReceivedFrame().type);
8692
assertEquals(AMQP.FRAME_METHOD, unexpectedFrameError.getExpectedFrameType());

0 commit comments

Comments
 (0)