code: function chainStack(stackElements){
      var stackEl, defaults = {
          incoming: function(message, origin){
              this.up.incoming(message, origin);
          },
          outgoing: function(message, recipient){
              this.down.outgoing(message, recipient);
          },
          callback: function(success){
              this.up.callback(success);
          },
          init: function(){
              this.down.init();
          },
          destroy: function(){
              this.down.destroy();
          }
      };
      for (var i = 0, len = stackElements.length; i < len; i++) {
          stackEl = stackElements[i];
          apply(stackEl, defaults, true);
          if (i !== 0) {
              stackEl.down = stackElements[i - 1];
          }
          if (i !== len - 1) {
              stackEl.up = stackElements[i + 1];
          }
      }
      return stackEl;
  }
docs: Chains all the separate stack elements into a single usable stack.<br/>
  If an element is missing a necessary method then it will have a pass-through method applied.
  @param {Array} stackElements An array of stack elements to be linked.
  @return {easyXDM.stack.StackElement} The last element in the chain.