io.netty.channel.unix.Errors.NativeIoException Java Examples

The following examples show how to use io.netty.channel.unix.Errors.NativeIoException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SyncopeSRAWebExceptionHandler.java    From syncope with Apache License 2.0 6 votes vote down vote up
@Override
public Mono<Void> handle(final ServerWebExchange exchange, final Throwable throwable) {
    if (throwable instanceof ConnectException
            || throwable instanceof NativeIoException
            || throwable instanceof NotFoundException) {

        LOG.error("ConnectException thrown", throwable);

        return doHandle(exchange, throwable, HttpStatus.NOT_FOUND);
    } else if (throwable instanceof OAuth2AuthorizationException) {
        LOG.error("OAuth2AuthorizationException thrown", throwable);

        return doHandle(exchange, throwable, HttpStatus.INTERNAL_SERVER_ERROR);
    }

    return Mono.error(throwable);
}
 
Example #2
Source File: KQueueSocketRstTest.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Override
protected void assertRstOnCloseException(IOException cause, Channel clientChannel) {
    if (!AbstractKQueueChannel.class.isInstance(clientChannel)) {
        super.assertRstOnCloseException(cause, clientChannel);
        return;
    }

    assertTrue("actual [type, message]: [" + cause.getClass() + ", " + cause.getMessage() + "]",
               cause instanceof NativeIoException);
    assertEquals(Errors.ERRNO_ECONNRESET_NEGATIVE, ((NativeIoException) cause).expectedErr());
}
 
Example #3
Source File: EpollSocketRstTest.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Override
protected void assertRstOnCloseException(IOException cause, Channel clientChannel) {
    if (!AbstractEpollChannel.class.isInstance(clientChannel)) {
        super.assertRstOnCloseException(cause, clientChannel);
        return;
    }

    assertTrue("actual [type, message]: [" + cause.getClass() + ", " + cause.getMessage() + "]",
               cause instanceof NativeIoException);
    assertEquals(Errors.ERRNO_ECONNRESET_NEGATIVE, ((NativeIoException) cause).expectedErr());
}
 
Example #4
Source File: ClientCnx.java    From pulsar with Apache License 2.0 4 votes vote down vote up
public static boolean isKnownException(Throwable t) {
    return t instanceof NativeIoException || t instanceof ClosedChannelException;
}