Search in sources :

Example 1 with ReflexiveProtocolHandler

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());
}
Also used : ReflexiveProtocolHandler(org.apache.nifi.cluster.protocol.impl.testutils.ReflexiveProtocolHandler) ProtocolMessage(org.apache.nifi.cluster.protocol.message.ProtocolMessage) PingMessage(org.apache.nifi.cluster.protocol.message.PingMessage) Test(org.junit.Test)

Aggregations

ReflexiveProtocolHandler (org.apache.nifi.cluster.protocol.impl.testutils.ReflexiveProtocolHandler)1 PingMessage (org.apache.nifi.cluster.protocol.message.PingMessage)1 ProtocolMessage (org.apache.nifi.cluster.protocol.message.ProtocolMessage)1 Test (org.junit.Test)1