package com.mercury.chat.client.protocol;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import com.mercury.chat.common.struct.protocol.Message;

public class AbstractClientMessageHandler extends SimpleChannelInboundHandler<Message> {

	@Override
	protected void messageReceived(ChannelHandlerContext ctx, Message msg) throws Exception {
		// TODO Auto-generated method stub
		
	}

}

@@ -49,103 +49,398 @@
 ort 
-io.netty.channel.ChannelHandlerContext;%0D%0Aimport io.netty.channel.SimpleChannelInboundHandler;%0D%0A
+java.util.Collection;%0D%0A%0D%0Aimport org.apache.logging.log4j.Level;%0D%0Aimport org.apache.logging.log4j.LogManager;%0D%0Aimport org.apache.logging.log4j.Logger;%0D%0A%0D%0Aimport io.netty.channel.ChannelHandlerContext;%0D%0Aimport io.netty.channel.SimpleChannelInboundHandler;%0D%0A%0D%0Aimport com.google.common.collect.Lists;%0D%0Aimport com.mercury.chat.common.MessageListener;%0D%0Aimport com.mercury.chat.common.MessageType;
 %0D%0Aim
@@ -503,16 +503,25 @@
 %0Apublic 
+abstract 
 class Ab
@@ -599,158 +599,774 @@
  %7B%0D%0A
+%09
 %0D%0A%09
-@Override%0D%0A%09protected void messageReceived(ChannelHandlerContext ctx, Message msg) throws Exception %7B%0D%0A%09%09// TODO Auto-generated method stub
+static final Logger logger = LogManager.getLogger(AbstractClientMessageHandler.class);%0D%0A%09%0D%0A%09private MessageType messageType;%0D%0A%09%0D%0A%09private volatile Collection%3CMessageListener%3E listeners = Lists.newArrayList();%0D%0A%09%0D%0A%09public AbstractClientMessageHandler(MessageType messageType) %7B%0D%0A%09%09super();%0D%0A%09%09this.messageType = messageType;%0D%0A%09%7D%0D%0A%09%0D%0A%09public void addMessageListener(MessageListener listener)%7B%0D%0A%09%09listeners.add(listener);%0D%0A%09%7D%0D%0A%0D%0A%09@Override%0D%0A    public void messageReceived(ChannelHandlerContext ctx, Message msg) %7B%0D%0A    %09logger.log(Level.INFO, %22Received Message:%22+msg);%0D%0A%09%09for (MessageListener listener : listeners) %7B%0D%0A%09%09%09listener.onMessage(msg);
 %0D%0A%09%09
+%7D
 %0D%0A%09
-%7D
+%09onMessage(ctx, msg);%0D%0A    %7D%0D%0A%09%0D%0A    protected abstract void onMessage(ChannelHandlerContext ctx, Message msg);
 %0D%0A%0D%0A

refactor the code change