use of io.grpc.internal.ServerImpl.JumpToApplicationThreadServerStreamListener in project grpc-java by grpc.
the class ServerImplTest method onReady_errorCancelsCall.
@Test
public void onReady_errorCancelsCall() {
JumpToApplicationThreadServerStreamListener listener = new JumpToApplicationThreadServerStreamListener(executor.getScheduledExecutorService(), stream, Context.ROOT.withCancellation());
ServerStreamListener mockListener = mock(ServerStreamListener.class);
listener.setListener(mockListener);
Throwable expectedT = new AssertionError();
doThrow(expectedT).when(mockListener).onReady();
listener.onReady();
try {
executor.runDueTasks();
fail("Expected exception");
} catch (Throwable t) {
assertSame(expectedT, t);
verify(stream).close(statusCaptor.capture(), any(Metadata.class));
assertSame(expectedT, statusCaptor.getValue().getCause());
}
}
Aggregations