@Test public void testOnChannelActivation() throws Exception { when(connection.isModeBoth()).thenReturn(false); sxpv4.onChannelActivation(channelHandlerContext, connection); verify(channelHandlerContext).writeAndFlush(any(ByteBuf.class)); verify(connection).setStatePendingOn(); when(connection.isModeBoth()).thenReturn(true); when(connection.isBidirectionalBoth()).thenReturn(false); sxpv4.onChannelActivation(channelHandlerContext, connection); verify(channelHandlerContext, times(2)).writeAndFlush(any(ByteBuf.class)); verify(connection, times(2)).setStatePendingOn(); when(connection.getMode()).thenReturn(ConnectionMode.None); when(connection.isBidirectionalBoth()).thenReturn(true); sxpv4.onChannelActivation(channelHandlerContext, connection); verify(channelHandlerContext, times(3)).writeAndFlush(any(ByteBuf.class)); verify(connection, times(3)).setStatePendingOn(); when(connection.isStateDeleteHoldDown()).thenReturn(true); when(connection.isStateOn()).thenReturn(true); sxpv4.onChannelActivation(channelHandlerContext, connection); verify(channelHandlerContext, times(4)).writeAndFlush(any(ByteBuf.class)); verify(connection, times(3)).setStatePendingOn(); verify(connection).setReconciliationTimer(); }
@Override public void onChannelActivation(final ChannelHandlerContext ctx, SxpConnection connection) { ByteBuf message; try { if (connection.isModeBoth()) { message = composeOpenHoldTimeMessage(connection, OpenMessageType.OPEN, ConnectionMode.Listener); } else { message = composeOpenHoldTimeMessage(connection, OpenMessageType.OPEN, connection.getMode()); } } catch (CapabilityLengthException | UnknownVersionException | HoldTimeMinException | AttributeVariantException | UnknownConnectionModeException | HoldTimeMaxException e) { LOG.error("{} Error sending OpenMessage due to creation error ", this, e); return; } LOG.info("{} Sending OPEN {}", connection, MessageFactory.toString(message)); ctx.writeAndFlush(message); if (connection.isStateDeleteHoldDown()) { connection.setReconciliationTimer(); } if (!connection.isStateOn()) { connection.setStatePendingOn(); } }
Sxpv4 extends AbstractStrategy { @Override public void onChannelActivation(final ChannelHandlerContext ctx, SxpConnection connection) { ByteBuf message; try { if (connection.isModeBoth()) { message = composeOpenHoldTimeMessage(connection, OpenMessageType.OPEN, ConnectionMode.Listener); } else { message = composeOpenHoldTimeMessage(connection, OpenMessageType.OPEN, connection.getMode()); } } catch (CapabilityLengthException | UnknownVersionException | HoldTimeMinException | AttributeVariantException | UnknownConnectionModeException | HoldTimeMaxException e) { LOG.error("{} Error sending OpenMessage due to creation error ", this, e); return; } LOG.info("{} Sending OPEN {}", connection, MessageFactory.toString(message)); ctx.writeAndFlush(message); if (connection.isStateDeleteHoldDown()) { connection.setReconciliationTimer(); } if (!connection.isStateOn()) { connection.setStatePendingOn(); } } }
Sxpv4 extends AbstractStrategy { @Override public void onChannelActivation(final ChannelHandlerContext ctx, SxpConnection connection) { ByteBuf message; try { if (connection.isModeBoth()) { message = composeOpenHoldTimeMessage(connection, OpenMessageType.OPEN, ConnectionMode.Listener); } else { message = composeOpenHoldTimeMessage(connection, OpenMessageType.OPEN, connection.getMode()); } } catch (CapabilityLengthException | UnknownVersionException | HoldTimeMinException | AttributeVariantException | UnknownConnectionModeException | HoldTimeMaxException e) { LOG.error("{} Error sending OpenMessage due to creation error ", this, e); return; } LOG.info("{} Sending OPEN {}", connection, MessageFactory.toString(message)); ctx.writeAndFlush(message); if (connection.isStateDeleteHoldDown()) { connection.setReconciliationTimer(); } if (!connection.isStateOn()) { connection.setStatePendingOn(); } } Sxpv4(SxpNode ownerNode); }
Sxpv4 extends AbstractStrategy { @Override public void onChannelActivation(final ChannelHandlerContext ctx, SxpConnection connection) { ByteBuf message; try { if (connection.isModeBoth()) { message = composeOpenHoldTimeMessage(connection, OpenMessageType.OPEN, ConnectionMode.Listener); } else { message = composeOpenHoldTimeMessage(connection, OpenMessageType.OPEN, connection.getMode()); } } catch (CapabilityLengthException | UnknownVersionException | HoldTimeMinException | AttributeVariantException | UnknownConnectionModeException | HoldTimeMaxException e) { LOG.error("{} Error sending OpenMessage due to creation error ", this, e); return; } LOG.info("{} Sending OPEN {}", connection, MessageFactory.toString(message)); ctx.writeAndFlush(message); if (connection.isStateDeleteHoldDown()) { connection.setReconciliationTimer(); } if (!connection.isStateOn()) { connection.setStatePendingOn(); } } Sxpv4(SxpNode ownerNode); @Override void onChannelActivation(final ChannelHandlerContext ctx, SxpConnection connection); @Override void onInputMessage(ChannelHandlerContext ctx, SxpConnection connection, Notification message); @Override Notification onParseInput(ByteBuf request); @Override ByteBuf onUpdateMessage(SxpConnection connection, List<T> deleteBindings,
            List<T> addBindings, SxpBindingFilter bindingFilter); }
Sxpv4 extends AbstractStrategy { @Override public void onChannelActivation(final ChannelHandlerContext ctx, SxpConnection connection) { ByteBuf message; try { if (connection.isModeBoth()) { message = composeOpenHoldTimeMessage(connection, OpenMessageType.OPEN, ConnectionMode.Listener); } else { message = composeOpenHoldTimeMessage(connection, OpenMessageType.OPEN, connection.getMode()); } } catch (CapabilityLengthException | UnknownVersionException | HoldTimeMinException | AttributeVariantException | UnknownConnectionModeException | HoldTimeMaxException e) { LOG.error("{} Error sending OpenMessage due to creation error ", this, e); return; } LOG.info("{} Sending OPEN {}", connection, MessageFactory.toString(message)); ctx.writeAndFlush(message); if (connection.isStateDeleteHoldDown()) { connection.setReconciliationTimer(); } if (!connection.isStateOn()) { connection.setStatePendingOn(); } } Sxpv4(SxpNode ownerNode); @Override void onChannelActivation(final ChannelHandlerContext ctx, SxpConnection connection); @Override void onInputMessage(ChannelHandlerContext ctx, SxpConnection connection, Notification message); @Override Notification onParseInput(ByteBuf request); @Override ByteBuf onUpdateMessage(SxpConnection connection, List<T> deleteBindings,
            List<T> addBindings, SxpBindingFilter bindingFilter);  }