use of org.apache.nifi.cluster.protocol.impl.testutils.ReflexiveProtocolHandler in project nifi by apache.
the class SocketProtocolListenerTest method testRequest.
@Test
public void testRequest() throws Exception {
ProtocolMessage msg = new PingMessage();
ReflexiveProtocolHandler handler = new ReflexiveProtocolHandler();
listener.addHandler(handler);
// marshal message to output stream
marshaller.marshal(msg, socket.getOutputStream());
// unmarshall response and return
ProtocolMessage response = unmarshaller.unmarshal(socket.getInputStream());
assertEquals(msg.getType(), response.getType());
assertEquals(1, handler.getMessages().size());
assertEquals(msg.getType(), handler.getMessages().get(0).getType());
}
Aggregations