client.addListener(messageHandler, callbackServerLocator);
client.addListener(messageHandler, connState.getCallbackServer().getLocator());
   public Object handleCreateConsumerDelegate(Invocation invocation) throws Throwable   {      MethodInvocation mi = (MethodInvocation)invocation;            //register/unregister a callback handler that deal with callbacks sent by the server      InvokerLocator serverLocator = (InvokerLocator)invocation.            getMetaData(MetaDataConstants.JMS, MetaDataConstants.INVOKER_LOCATOR);      if (serverLocator == null)      {         throw new RuntimeException("No InvokerLocator supplied. Can't invoke remotely!");      }            // TODO Get rid of this (http://jira.jboss.org/jira/browse/JBMESSAGING-92)      Connector callbackServer = Remoting.getCallbackServer();            InvokerLocator callbackServerLocator = callbackServer.getLocator();            if (log.isTraceEnabled())      {         log.trace("Callback server listening on " + callbackServerLocator);      }      boolean isCC = ((Boolean)mi.getArguments()[4]).booleanValue();      //Create the message handler      SessionState sessState = (SessionState)((DelegateSupport)invocation.getTargetObject()).getState();            ConnectionState connState = (ConnectionState)sessState.getParent();            MessageCallbackHandler messageHandler = new MessageCallbackHandler(isCC, sessState.getAcknowledgeMode(),                                                                         sessState.getExecutor(), connState.getPooledExecutor());      Client client = new Client(serverLocator, "JMS");            client.addListener(messageHandler, callbackServerLocator);      // I will need this on the server-side to create the ConsumerDelegate instance      invocation.getMetaData().addMetaData(MetaDataConstants.JMS, MetaDataConstants.REMOTING_SESSION_ID,                                     client.getSessionId(), PayloadKey.AS_IS);      ConsumerDelegate consumerDelegate = (ConsumerDelegate)invocation.invokeNext();            SessionDelegate del = (SessionDelegate)invocation.getTargetObject();      ConsumerState theState = (ConsumerState)((DelegateSupport)consumerDelegate).getState();               messageHandler.setSessionDelegate(del);      messageHandler.setConsumerDelegate(consumerDelegate);      messageHandler.setConsumerID(theState.getConsumerID());      messageHandler.setCallbackServer(callbackServer, client); // TODO Get rid of this (http://jira.jboss.org/jira/browse/JBMESSAGING-92)      //Add to the instance advisor's metadata      SimpleMetaData instanceMetaData = ((Advised)consumerDelegate)._getInstanceAdvisor().getMetaData();            instanceMetaData.addMetaData(MetaDataConstants.JMS, MetaDataConstants.MESSAGE_HANDLER, messageHandler, PayloadKey.TRANSIENT);            return consumerDelegate;   }