/* (non-Javadoc)
  * @see io.netty.channel.ChannelInboundMessageHandlerAdapter#decode(io.netty.channel.ChannelHandlerContext, java.lang.Object)
  */
 @Override
 protected void decode(ChannelHandlerContext ctx, WirePayload msg, List<Object> out)
     throws Exception {
   if (msg.hasRpcResponse()) {
     rpcClient.response(msg.getRpcResponse());
     return;
   } else if (msg.hasRpcError()) {
     rpcClient.error(msg.getRpcError());
     return;
   } else if (msg.hasOobResponse()) {
     rpcClient.receiveOobResponse(msg.getOobResponse());
     return;
   } else if (msg.hasOobMessage()) {
     rpcClient.receiveOobMessage(msg.getOobMessage());
     return;
   } else if (msg.hasTransparentMessage()) {
     // just so that it's not forgotten sometime...
     out.add(msg);
   } else {
     // rpcRequest, rpcCancel, clientMessage go further up to the RpcServerHandler
     // transparentMessage are also sent up but not handled anywhere explicitly
     out.add(msg);
   }
 }
 /* (non-Javadoc)
  * @see io.netty.channel.ChannelStateHandlerAdapter#channelInactive(io.netty.channel.ChannelHandlerContext)
  */
 @Override
 public void channelInactive(ChannelHandlerContext ctx) throws Exception {
   super.channelInactive(ctx);
   rpcClient.handleClosure();
   notifyClosed();
 }