/** * Alerts all relevant message listeners that a message has been received. * * <p>If this client connection is running on the side of a server, the message listeners are * found through the parentServer reference. * * <p>If this client connection is running on the side of a client, the message listener is * 'listener' variable. * * @param msg The message that was just received. * @param hostType The type of the host who sent the message */ protected void notifyMessageListeners(Message msg, HostType hostType) { if (serverConnection) { // TODO: This won't function if we have multiple messageListeners. for (MessageListenerInterface listener : parentServer.getMessageListeners()) listener.notifyMessage(msg, hostType); } else { listener.notifyMessage(msg, hostType); } }