use of com.rabbitmq.client.impl.AMQImpl.Basic.Publish 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");
}
Aggregations