use of org.apache.nifi.remote.io.socket.SocketChannelCommunicationsSession in project nifi by apache.
the class TestSocketClientTransaction method getClientTransaction.
private SocketClientTransaction getClientTransaction(ByteArrayInputStream bis, ByteArrayOutputStream bos, TransferDirection direction) throws IOException {
PeerDescription description = null;
String peerUrl = "";
SocketChannelCommunicationsSession commsSession = mock(SocketChannelCommunicationsSession.class);
SocketChannelInput socketIn = mock(SocketChannelInput.class);
SocketChannelOutput socketOut = mock(SocketChannelOutput.class);
when(commsSession.getInput()).thenReturn(socketIn);
when(commsSession.getOutput()).thenReturn(socketOut);
when(socketIn.getInputStream()).thenReturn(bis);
when(socketOut.getOutputStream()).thenReturn(bos);
String clusterUrl = "";
Peer peer = new Peer(description, commsSession, peerUrl, clusterUrl);
boolean useCompression = false;
int penaltyMillis = 1000;
EventReporter eventReporter = null;
int protocolVersion = 5;
String destinationId = "destinationId";
return new SocketClientTransaction(protocolVersion, destinationId, peer, codec, direction, useCompression, penaltyMillis, eventReporter);
}
Aggregations