@Test(expected = Exception.class) public void testExceptionCaught() throws Exception { channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class); ExceptionEvent exception = EasyMock.createMock(ExceptionEvent.class); ospfInterfaceChannelHandler.exceptionCaught(channelHandlerContext, exception); assertThat(ospfInterfaceChannelHandler, is(notNullValue())); }
@Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { log.debug("[exceptionCaught]: " + e.toString()); if (e.getCause() instanceof ReadTimeoutException) { log.debug("Disconnecting device {} due to read timeout", e.getChannel().getRemoteAddress()); return; } else if (e.getCause() instanceof ClosedChannelException) { log.debug("Channel for OSPF {} already closed", e.getChannel().getRemoteAddress()); } else if (e.getCause() instanceof IOException) { log.debug("Disconnecting OSPF {} due to IO Error: {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } else if (e.getCause() instanceof OspfParseException) { OspfParseException errMsg = (OspfParseException) e.getCause(); byte errorCode = errMsg.errorCode(); byte errorSubCode = errMsg.errorSubCode(); log.debug("Error while parsing message from OSPF {}, ErrorCode {}", e.getChannel().getRemoteAddress(), errorCode); } else if (e.getCause() instanceof RejectedExecutionException) { log.debug("Could not process message: queue full"); } else { log.debug("Error while processing message from OSPF {}, {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } }
OspfInterfaceChannelHandler extends IdleStateAwareChannelHandler { @Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { log.debug("[exceptionCaught]: " + e.toString()); if (e.getCause() instanceof ReadTimeoutException) { log.debug("Disconnecting device {} due to read timeout", e.getChannel().getRemoteAddress()); return; } else if (e.getCause() instanceof ClosedChannelException) { log.debug("Channel for OSPF {} already closed", e.getChannel().getRemoteAddress()); } else if (e.getCause() instanceof IOException) { log.debug("Disconnecting OSPF {} due to IO Error: {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } else if (e.getCause() instanceof OspfParseException) { OspfParseException errMsg = (OspfParseException) e.getCause(); byte errorCode = errMsg.errorCode(); byte errorSubCode = errMsg.errorSubCode(); log.debug("Error while parsing message from OSPF {}, ErrorCode {}", e.getChannel().getRemoteAddress(), errorCode); } else if (e.getCause() instanceof RejectedExecutionException) { log.debug("Could not process message: queue full"); } else { log.debug("Error while processing message from OSPF {}, {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } } }
OspfInterfaceChannelHandler extends IdleStateAwareChannelHandler { @Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { log.debug("[exceptionCaught]: " + e.toString()); if (e.getCause() instanceof ReadTimeoutException) { log.debug("Disconnecting device {} due to read timeout", e.getChannel().getRemoteAddress()); return; } else if (e.getCause() instanceof ClosedChannelException) { log.debug("Channel for OSPF {} already closed", e.getChannel().getRemoteAddress()); } else if (e.getCause() instanceof IOException) { log.debug("Disconnecting OSPF {} due to IO Error: {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } else if (e.getCause() instanceof OspfParseException) { OspfParseException errMsg = (OspfParseException) e.getCause(); byte errorCode = errMsg.errorCode(); byte errorSubCode = errMsg.errorSubCode(); log.debug("Error while parsing message from OSPF {}, ErrorCode {}", e.getChannel().getRemoteAddress(), errorCode); } else if (e.getCause() instanceof RejectedExecutionException) { log.debug("Could not process message: queue full"); } else { log.debug("Error while processing message from OSPF {}, {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } } OspfInterfaceChannelHandler(Controller controller, List<OspfProcess> processes); }
OspfInterfaceChannelHandler extends IdleStateAwareChannelHandler { @Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { log.debug("[exceptionCaught]: " + e.toString()); if (e.getCause() instanceof ReadTimeoutException) { log.debug("Disconnecting device {} due to read timeout", e.getChannel().getRemoteAddress()); return; } else if (e.getCause() instanceof ClosedChannelException) { log.debug("Channel for OSPF {} already closed", e.getChannel().getRemoteAddress()); } else if (e.getCause() instanceof IOException) { log.debug("Disconnecting OSPF {} due to IO Error: {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } else if (e.getCause() instanceof OspfParseException) { OspfParseException errMsg = (OspfParseException) e.getCause(); byte errorCode = errMsg.errorCode(); byte errorSubCode = errMsg.errorSubCode(); log.debug("Error while parsing message from OSPF {}, ErrorCode {}", e.getChannel().getRemoteAddress(), errorCode); } else if (e.getCause() instanceof RejectedExecutionException) { log.debug("Could not process message: queue full"); } else { log.debug("Error while processing message from OSPF {}, {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } } OspfInterfaceChannelHandler(Controller controller, List<OspfProcess> processes); void initializeInterfaceMap(); void updateInterfaceMap(List<OspfProcess> ospfProcesses); @Override void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent evt); @Override void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent evt); @Override void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent
            e); @Override void messageReceived(ChannelHandlerContext ctx, MessageEvent
            e); void processOspfMessage(OspfMessage
                                           ospfMessage, ChannelHandlerContext ctx); void sentConfigPacket(byte[] configPacket); }
OspfInterfaceChannelHandler extends IdleStateAwareChannelHandler { @Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { log.debug("[exceptionCaught]: " + e.toString()); if (e.getCause() instanceof ReadTimeoutException) { log.debug("Disconnecting device {} due to read timeout", e.getChannel().getRemoteAddress()); return; } else if (e.getCause() instanceof ClosedChannelException) { log.debug("Channel for OSPF {} already closed", e.getChannel().getRemoteAddress()); } else if (e.getCause() instanceof IOException) { log.debug("Disconnecting OSPF {} due to IO Error: {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } else if (e.getCause() instanceof OspfParseException) { OspfParseException errMsg = (OspfParseException) e.getCause(); byte errorCode = errMsg.errorCode(); byte errorSubCode = errMsg.errorSubCode(); log.debug("Error while parsing message from OSPF {}, ErrorCode {}", e.getChannel().getRemoteAddress(), errorCode); } else if (e.getCause() instanceof RejectedExecutionException) { log.debug("Could not process message: queue full"); } else { log.debug("Error while processing message from OSPF {}, {}", e.getChannel().getRemoteAddress(), e.getCause().getMessage()); } } OspfInterfaceChannelHandler(Controller controller, List<OspfProcess> processes); void initializeInterfaceMap(); void updateInterfaceMap(List<OspfProcess> ospfProcesses); @Override void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent evt); @Override void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent evt); @Override void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent
            e); @Override void messageReceived(ChannelHandlerContext ctx, MessageEvent
            e); void processOspfMessage(OspfMessage
                                           ospfMessage, ChannelHandlerContext ctx); void sentConfigPacket(byte[] configPacket);  }