@Test public void testOnChannelActivation() throws Exception { byte i = 1; for (ConnectionMode mode : ConnectionMode.values()) { when(connection.getMode()).thenReturn(mode); sxpLegacy.onChannelActivation(channelHandlerContext, connection); verify(channelHandlerContext, times(i)).writeAndFlush(any(ByteBuf.class)); verify(connection, times(i++)).setStatePendingOn(); } when(connection.isStateDeleteHoldDown()).thenReturn(true); sxpLegacy.onChannelActivation(channelHandlerContext, connection); verify(channelHandlerContext, times(i)).writeAndFlush(any(ByteBuf.class)); verify(connection, times(i++)).setStatePendingOn(); verify(connection).setReconciliationTimer(); }
@Override public void onChannelActivation(ChannelHandlerContext ctx, SxpConnection connection) { ConnectionMode connectionMode = ConnectionMode.Speaker; if (connection.getMode() != null && !connection.getMode().equals(ConnectionMode.None)) { connectionMode = connection.getMode(); } ByteBuf message = LegacyMessageFactory.createOpen(connection.getVersion(), connectionMode); LOG.info("{} Sending OPEN {}", connection, MessageFactory.toString(message)); ctx.writeAndFlush(message); if (connection.isStateDeleteHoldDown()) { connection.setReconciliationTimer(); } if (!connection.isStateOn()) { connection.setStatePendingOn(); } }
SxpLegacy extends AbstractStrategy { @Override public void onChannelActivation(ChannelHandlerContext ctx, SxpConnection connection) { ConnectionMode connectionMode = ConnectionMode.Speaker; if (connection.getMode() != null && !connection.getMode().equals(ConnectionMode.None)) { connectionMode = connection.getMode(); } ByteBuf message = LegacyMessageFactory.createOpen(connection.getVersion(), connectionMode); LOG.info("{} Sending OPEN {}", connection, MessageFactory.toString(message)); ctx.writeAndFlush(message); if (connection.isStateDeleteHoldDown()) { connection.setReconciliationTimer(); } if (!connection.isStateOn()) { connection.setStatePendingOn(); } } }
SxpLegacy extends AbstractStrategy { @Override public void onChannelActivation(ChannelHandlerContext ctx, SxpConnection connection) { ConnectionMode connectionMode = ConnectionMode.Speaker; if (connection.getMode() != null && !connection.getMode().equals(ConnectionMode.None)) { connectionMode = connection.getMode(); } ByteBuf message = LegacyMessageFactory.createOpen(connection.getVersion(), connectionMode); LOG.info("{} Sending OPEN {}", connection, MessageFactory.toString(message)); ctx.writeAndFlush(message); if (connection.isStateDeleteHoldDown()) { connection.setReconciliationTimer(); } if (!connection.isStateOn()) { connection.setStatePendingOn(); } } SxpLegacy(Version sxpVersion); }
SxpLegacy extends AbstractStrategy { @Override public void onChannelActivation(ChannelHandlerContext ctx, SxpConnection connection) { ConnectionMode connectionMode = ConnectionMode.Speaker; if (connection.getMode() != null && !connection.getMode().equals(ConnectionMode.None)) { connectionMode = connection.getMode(); } ByteBuf message = LegacyMessageFactory.createOpen(connection.getVersion(), connectionMode); LOG.info("{} Sending OPEN {}", connection, MessageFactory.toString(message)); ctx.writeAndFlush(message); if (connection.isStateDeleteHoldDown()) { connection.setReconciliationTimer(); } if (!connection.isStateOn()) { connection.setStatePendingOn(); } } SxpLegacy(Version sxpVersion); @Override void onChannelActivation(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); }
SxpLegacy extends AbstractStrategy { @Override public void onChannelActivation(ChannelHandlerContext ctx, SxpConnection connection) { ConnectionMode connectionMode = ConnectionMode.Speaker; if (connection.getMode() != null && !connection.getMode().equals(ConnectionMode.None)) { connectionMode = connection.getMode(); } ByteBuf message = LegacyMessageFactory.createOpen(connection.getVersion(), connectionMode); LOG.info("{} Sending OPEN {}", connection, MessageFactory.toString(message)); ctx.writeAndFlush(message); if (connection.isStateDeleteHoldDown()) { connection.setReconciliationTimer(); } if (!connection.isStateOn()) { connection.setStatePendingOn(); } } SxpLegacy(Version sxpVersion); @Override void onChannelActivation(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);  }