@Test public void testNullTrackerGetNextMessageIdReturnsMid() { config.set(NetworkConfig.Keys.MID_TRACKER, "NULL"); InMemoryMessageIdProvider provider = new InMemoryMessageIdProvider(config); InetSocketAddress peerAddress = getPeerAddress(1); int mid1 = provider.getNextMessageId(peerAddress); int mid2 = provider.getNextMessageId(peerAddress); assertThat(mid1, is(not(Message.NONE))); assertThat(mid2, is(not(Message.NONE))); assertThat(mid1, is(not(mid2))); for (int index = 0; index < TOTAL_NO_OF_MIDS * 2; ++index) { int mid = provider.getNextMessageId(peerAddress); assertThat(mid, is(not(Message.NONE))); } }
@Override public int getNextMessageId(final InetSocketAddress destination) { MessageIdTracker tracker = getTracker(destination); if (tracker == null) { return Message.NONE; } else { return tracker.getNextMessageId(); } }
InMemoryMessageIdProvider implements MessageIdProvider { @Override public int getNextMessageId(final InetSocketAddress destination) { MessageIdTracker tracker = getTracker(destination); if (tracker == null) { return Message.NONE; } else { return tracker.getNextMessageId(); } } }
InMemoryMessageIdProvider implements MessageIdProvider { @Override public int getNextMessageId(final InetSocketAddress destination) { MessageIdTracker tracker = getTracker(destination); if (tracker == null) { return Message.NONE; } else { return tracker.getNextMessageId(); } } InMemoryMessageIdProvider(final NetworkConfig config); }
InMemoryMessageIdProvider implements MessageIdProvider { @Override public int getNextMessageId(final InetSocketAddress destination) { MessageIdTracker tracker = getTracker(destination); if (tracker == null) { return Message.NONE; } else { return tracker.getNextMessageId(); } } InMemoryMessageIdProvider(final NetworkConfig config); @Override int getNextMessageId(final InetSocketAddress destination); }
InMemoryMessageIdProvider implements MessageIdProvider { @Override public int getNextMessageId(final InetSocketAddress destination) { MessageIdTracker tracker = getTracker(destination); if (tracker == null) { return Message.NONE; } else { return tracker.getNextMessageId(); } } InMemoryMessageIdProvider(final NetworkConfig config); @Override int getNextMessageId(final InetSocketAddress destination);  }