// Path: src/main/java/com/my/lionrpc/protocol/ResponseMessage.java
// public class ResponseMessage implements Serializable{
// 
// 	private static final long serialVersionUID = -6845726676952200560L;
// 	private String requestId;
//     private String error;
//     private Object result;
// 
//     public boolean isError() {
//         return error != null;
//     }
// 
//     public String getRequestId() {
//         return requestId;
//     }
// 
//     public void setRequestId(String requestId) {
//         this.requestId = requestId;
//     }
// 
//     public String getError() {
//         return error;
//     }
// 
//     public void setError(String error) {
//         this.error = error;
//     }
// 
//     public Object getResult() {
//         return result;
//     }
// 
//     public void setResult(Object result) {
//         this.result = result;
//     }
// 
// }


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.my.lionrpc.protocol.ResponseMessage;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
package com.my.lionrpc.client;




/**
 * Created by littlechen on 17/5/21.
 */
public class LionClientChannelInboundHandler extends SimpleChannelInboundHandler<ResponseMessage>{
	
	private static final Logger LOG = LoggerFactory.getLogger(LionClientChannelInboundHandler.class);

    protected void channelRead0(ChannelHandlerContext channelHandlerContext, ResponseMessage responseMessage) throws Exception {
    	RequestRepositryRegistry.callBack(responseMessage);
    }
    
    
    @Override
    public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
    	super.channelRegistered(ctx);
// Path: src/main/java/com/my/lionrpc/protocol/ResponseMessage.java
// public class ResponseMessage implements Serializable{
// 
// 	private static final long serialVersionUID = -6845726676952200560L;
// 	private String requestId;
//     private String error;
//     private Object result;
// 
//     public boolean isError() {
//         return error != null;
//     }
// 
//     public String getRequestId() {
//         return requestId;
//     }
// 
//     public void setRequestId(String requestId) {
//         this.requestId = requestId;
//     }
// 
//     public String getError() {
//         return error;
//     }
// 
//     public void setError(String error) {
//         this.error = error;
//     }
// 
//     public Object getResult() {
//         return result;
//     }
// 
//     public void setResult(Object result) {
//         this.result = result;
//     }
// 
// }


// Path: src/main/java/com/my/lionrpc/client/LionClientChannelInboundHandler.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.my.lionrpc.protocol.ResponseMessage;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

package com.my.lionrpc.client;




/**
 * Created by littlechen on 17/5/21.
 */
public class LionClientChannelInboundHandler extends SimpleChannelInboundHandler<ResponseMessage>{
	
	private static final Logger LOG = LoggerFactory.getLogger(LionClientChannelInboundHandler.class);

    protected void channelRead0(ChannelHandlerContext channelHandlerContext, ResponseMessage responseMessage) throws Exception {
    	RequestRepositryRegistry.callBack(responseMessage);
    }
    
    
    @Override
    public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
    	super.channelRegistered(ctx);
    	if(ctx.channel()!= null && ctx.channel().remoteAddress()!=null){