StandardMessenger implements Messenger { public Set<String> getIncomingChannels() { synchronized (incomingLock) { Set<String> keys = incomingByChannel.keySet(); return ImmutableSet.copyOf(keys); } }  boolean isReservedChannel(String channel); void registerOutgoingPluginChannel(Plugin plugin, String channel); void unregisterOutgoingPluginChannel(Plugin plugin, String channel); void unregisterOutgoingPluginChannel(Plugin plugin); PluginMessageListenerRegistration registerIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener); void unregisterIncomingPluginChannel(Plugin plugin, String channel, PluginMessageListener listener); void unregisterIncomingPluginChannel(Plugin plugin, String channel); void unregisterIncomingPluginChannel(Plugin plugin); Set<String> getOutgoingChannels(); Set<String> getOutgoingChannels(Plugin plugin); Set<String> getIncomingChannels(); Set<String> getIncomingChannels(Plugin plugin); Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(Plugin plugin); Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(String channel); Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(Plugin plugin, String channel); boolean isRegistrationValid(PluginMessageListenerRegistration registration); boolean isIncomingChannelRegistered(Plugin plugin, String channel); boolean isOutgoingChannelRegistered(Plugin plugin, String channel); void dispatchIncomingMessage(Player source, String channel, byte[] message); static void validateChannel(String channel); static void validatePluginMessage(Messenger messenger, Plugin source, String channel, byte[] message);  }
@Test public void testGetIncomingChannels() { Messenger messenger = getMessenger(); TestPlugin plugin1 = getPlugin(); TestPlugin plugin2 = getPlugin(); assertEquals(messenger.getIncomingChannels()); messenger.registerIncomingPluginChannel(plugin1, "foo", new TestMessageListener("foo", "bar".getBytes())); messenger.registerIncomingPluginChannel(plugin1, "bar", new TestMessageListener("foo", "bar".getBytes())); messenger.registerIncomingPluginChannel(plugin2, "baz", new TestMessageListener("foo", "bar".getBytes())); messenger.registerIncomingPluginChannel(plugin2, "baz", new TestMessageListener("foo", "bar".getBytes())); assertEquals(messenger.getIncomingChannels(), "foo", "bar", "baz"); }