Search in sources :

Example 1 with ProtocolContext

use of org.apache.nifi.cluster.protocol.ProtocolContext in project nifi by apache.

the class SocketProtocolListenerTest method setup.

@Before
public void setup() throws Exception {
    final ProtocolContext protocolContext = new JaxbProtocolContext(JaxbProtocolUtils.JAXB_CONTEXT);
    marshaller = protocolContext.createMarshaller();
    unmarshaller = protocolContext.createUnmarshaller();
    ServerSocketConfiguration configuration = new ServerSocketConfiguration();
    configuration.setSocketTimeout(1000);
    listener = new SocketProtocolListener(5, 0, configuration, protocolContext);
    listener.start();
    int port = listener.getPort();
    SocketConfiguration config = new SocketConfiguration();
    config.setReuseAddress(true);
    config.setSocketTimeout(1000);
    socket = SocketUtils.createSocket(new InetSocketAddress("localhost", port), config);
}
Also used : ServerSocketConfiguration(org.apache.nifi.io.socket.ServerSocketConfiguration) InetSocketAddress(java.net.InetSocketAddress) JaxbProtocolContext(org.apache.nifi.cluster.protocol.jaxb.JaxbProtocolContext) ProtocolContext(org.apache.nifi.cluster.protocol.ProtocolContext) SocketConfiguration(org.apache.nifi.io.socket.SocketConfiguration) ServerSocketConfiguration(org.apache.nifi.io.socket.ServerSocketConfiguration) JaxbProtocolContext(org.apache.nifi.cluster.protocol.jaxb.JaxbProtocolContext) Before(org.junit.Before)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)1 ProtocolContext (org.apache.nifi.cluster.protocol.ProtocolContext)1 JaxbProtocolContext (org.apache.nifi.cluster.protocol.jaxb.JaxbProtocolContext)1 ServerSocketConfiguration (org.apache.nifi.io.socket.ServerSocketConfiguration)1 SocketConfiguration (org.apache.nifi.io.socket.SocketConfiguration)1 Before (org.junit.Before)1