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);
}
Aggregations