Search in sources :

Example 6 with SocketChannelCommunicationsSession

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);
}
Also used : PeerDescription(org.apache.nifi.remote.PeerDescription) SocketChannelInput(org.apache.nifi.remote.io.socket.SocketChannelInput) Peer(org.apache.nifi.remote.Peer) SocketChannelOutput(org.apache.nifi.remote.io.socket.SocketChannelOutput) SocketChannelCommunicationsSession(org.apache.nifi.remote.io.socket.SocketChannelCommunicationsSession) EventReporter(org.apache.nifi.events.EventReporter)

Aggregations

SocketChannelCommunicationsSession (org.apache.nifi.remote.io.socket.SocketChannelCommunicationsSession)6 SocketChannel (java.nio.channels.SocketChannel)4 CommunicationsSession (org.apache.nifi.remote.protocol.CommunicationsSession)4 ByteArrayInputStream (java.io.ByteArrayInputStream)2 DataInputStream (java.io.DataInputStream)2 DataOutputStream (java.io.DataOutputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 InetSocketAddress (java.net.InetSocketAddress)2 ProvenanceEventRecord (org.apache.nifi.provenance.ProvenanceEventRecord)2 Peer (org.apache.nifi.remote.Peer)2 PeerDescription (org.apache.nifi.remote.PeerDescription)2 HttpCommunicationsSession (org.apache.nifi.remote.io.http.HttpCommunicationsSession)2 SocketChannelInput (org.apache.nifi.remote.io.socket.SocketChannelInput)2 SocketChannelOutput (org.apache.nifi.remote.io.socket.SocketChannelOutput)2 SSLSocketChannel (org.apache.nifi.remote.io.socket.ssl.SSLSocketChannel)2 SSLSocketChannelCommunicationsSession (org.apache.nifi.remote.io.socket.ssl.SSLSocketChannelCommunicationsSession)2 MockFlowFile (org.apache.nifi.util.MockFlowFile)2 Test (org.junit.Test)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1