use of org.apache.nifi.processor.util.listen.response.ChannelResponse in project nifi by apache.
the class TestRELPFrameHandler method testClose.
@Test
public void testClose() throws IOException, InterruptedException {
final RELPFrame openFrame = new RELPFrame.Builder().txnr(1).command("close").dataLength(0).data(new byte[0]).build();
final String sender = "sender1";
final CapturingChannelResponder responder = new CapturingChannelResponder();
// call the handler and verify respond() was called once with once response
frameHandler.handle(openFrame, responder, sender);
Assert.assertEquals(1, responder.responded);
Assert.assertEquals(1, responder.responses.size());
// verify the response sent back the offers that were received
final ChannelResponse response = responder.responses.get(0);
final String responseData = new String(response.toByteArray(), charset);
Assert.assertTrue(responseData.contains("200 OK"));
}
Aggregations