use of com.rabbitmq.client.UnexpectedFrameError in project rabbitmq-java-client by rabbitmq.
the class BrokenFramesTest method methodThenBody.
@Test
public void methodThenBody() throws Exception {
List<Frame> frames = new ArrayList<Frame>();
byte[] contentBody = new byte[10];
int channelNumber = 0;
Publish method = new Publish(1, "test", "test", false, false);
frames.add(method.toFrame(0));
frames.add(Frame.fromBodyFragment(channelNumber, contentBody, 0, contentBody.length));
myFrameHandler.setFrames(frames.iterator());
try {
new AMQConnection(factory.params(Executors.newFixedThreadPool(1)), myFrameHandler).start();
} catch (IOException e) {
UnexpectedFrameError unexpectedFrameError = findUnexpectedFrameError(e);
assertNotNull(unexpectedFrameError);
assertEquals(AMQP.FRAME_BODY, unexpectedFrameError.getReceivedFrame().type);
assertEquals(AMQP.FRAME_HEADER, unexpectedFrameError.getExpectedFrameType());
return;
}
fail("No UnexpectedFrameError thrown");
}
use of com.rabbitmq.client.UnexpectedFrameError in project rabbitmq-java-client by rabbitmq.
the class BrokenFramesTest method noMethod.
@Test
public void noMethod() throws Exception {
List<Frame> frames = new ArrayList<Frame>();
frames.add(new Frame(AMQP.FRAME_HEADER, 0));
myFrameHandler.setFrames(frames.iterator());
try {
new AMQConnection(factory.params(Executors.newFixedThreadPool(1)), myFrameHandler).start();
} catch (IOException e) {
UnexpectedFrameError unexpectedFrameError = findUnexpectedFrameError(e);
assertNotNull(unexpectedFrameError);
assertEquals(AMQP.FRAME_HEADER, unexpectedFrameError.getReceivedFrame().type);
assertEquals(AMQP.FRAME_METHOD, unexpectedFrameError.getExpectedFrameType());
return;
}
fail("No UnexpectedFrameError thrown");
}
Aggregations