SocketDataInfo expectedContinueSdi = SocketDataInfo.newBuilder()
.setConnectionId(CONNECTION_ID)
.setSegment(ByteString.copyFrom(expectedPayload))
.setState(SocketDataInfo.State.CONTINUE)
.build();
FrameInfo expectedContinueFrame = FrameInfo.newBuilder()
.setType(FrameInfo.Type.SOCKET_DATA)
.setPayload(expectedContinueSdi.toByteString())
.build();
SocketDataInfo expectedClosingSdi = SocketDataInfo.newBuilder()
.setConnectionId(CONNECTION_ID)
.setState(SocketDataInfo.State.CLOSE)
.build();
FrameInfo expectedClosingFrame = FrameInfo.newBuilder()
.setType(Type.SOCKET_DATA)
.setPayload(expectedClosingSdi.toByteString())
.build();
MockConnectionRemover connectionRemover = new MockConnectionRemover();
InputStreamConnector inputStreamConnector = new InputStreamConnector();
inputStreamConnector.setInputStream(bis);
inputStreamConnector.setConnectionId(CONNECTION_ID);
inputStreamConnector.setFrameSender(frameSender);
inputStreamConnector.setConnectorStateCallback(connectionRemover);
inputStreamConnector.start(); // LARGE TEST.
FrameInfo actualContinueFrame = sendQueue.take();
assertEquals(expectedContinueFrame, actualContinueFrame);
FrameInfo actualClosingFrame = sendQueue.take();
assertEquals(expectedClosingFrame, actualClosingFrame);
}