use of io.servicetalk.transport.netty.internal.CloseHandler.CloseEventObservedException in project servicetalk by apple.
the class GracefulConnectionClosureHandlingTest method assertClosedChannelException.
private void assertClosedChannelException(Executable runnable, CloseEvent expectedCloseEvent) {
Exception e = assertThrows(ExecutionException.class, runnable);
Throwable cause = e.getCause();
assertThat(cause, anyOf(instanceOf(ClosedChannelException.class), instanceOf(IOException.class)));
if (protocol == HTTP_2) {
// HTTP/2 does not enhance ClosedChannelException with CloseEvent
return;
}
while (cause != null && !(cause instanceof CloseEventObservedException)) {
cause = cause.getCause();
}
assertThat("Exception is not enhanced with CloseEvent", cause, is(notNullValue()));
assertThat(((CloseEventObservedException) cause).event(), is(expectedCloseEvent));
}
Aggregations