use of com.navercorp.pinpoint.collector.receiver.grpc.RecordedStreamObserver in project pinpoint by naver.
the class GrpcCommandServiceTest method assertHandleMessage.
private void assertHandleMessage(GrpcCommandService commandService, TransportMetadata transportMetaData) {
RecordedStreamObserver<Empty> recordedStreamObserver = new RecordedStreamObserver<>();
PCmdEchoResponse defaultInstance = PCmdEchoResponse.getDefaultInstance();
commandService.commandEcho(defaultInstance, recordedStreamObserver);
Assert.assertNull(recordedStreamObserver.getLatestThrowable());
attachContext(createTransportMetaData(transportMetaData.getRemoteAddress(), transportMetaData.getTransportId() + 1));
commandService.commandEcho(defaultInstance, recordedStreamObserver);
Assert.assertNotNull(recordedStreamObserver.getLatestThrowable());
StreamObserver<PCmdActiveThreadCountRes> pCmdActiveThreadCountResStreamObserver = commandService.commandStreamActiveThreadCount(new TempServerCallStreamObserver<>());
Assert.assertNotNull(pCmdActiveThreadCountResStreamObserver);
attachContext(transportMetaData);
TempServerCallStreamObserver<Empty> streamConnectionManagerObserver = new TempServerCallStreamObserver<>();
pCmdActiveThreadCountResStreamObserver = commandService.commandStreamActiveThreadCount(streamConnectionManagerObserver);
Assert.assertNull(streamConnectionManagerObserver.getLatestException());
pCmdActiveThreadCountResStreamObserver.onNext(PCmdActiveThreadCountRes.getDefaultInstance());
Assert.assertNotNull(streamConnectionManagerObserver.getLatestException());
}
Aggregations