StandardMessenger implements Messenger { public void registerOutgoingPluginChannel(Plugin plugin, String channel) { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } validateChannel(channel); if (isReservedChannel(channel)) { throw new ReservedChannelException(channel); } addToOutgoing(plugin, channel); }  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(expected = ReservedChannelException.class) public void testReservedOutgoingRegistration() { Messenger messenger = getMessenger(); TestPlugin plugin = getPlugin(); messenger.registerOutgoingPluginChannel(plugin, "REGISTER"); }