code: public void chainPolicyHandlers() {
          IReadWriteStream<H> previousHandler = null;
          Iterator<PolicyWithConfiguration> iterator = iterator();
          while (iterator.hasNext()) {
              final PolicyWithConfiguration pwc = iterator.next();
              final IPolicy policy = pwc.getPolicy();
              final IReadWriteStream<H> handler = getApiHandler(policy, pwc.getConfiguration());
              if (handler == null) {
                  continue;
              }
  
              if (headPolicyHandler == null) {
                  headPolicyHandler = handler;
              }
  
              if (previousHandler != null) {
                  previousHandler.bodyHandler(new IAsyncHandler<IApimanBuffer>() {
                      @Override
                      public void handle(IApimanBuffer result) {
                          handler.write(result);
                      }
                  });
                  previousHandler.endHandler(new IAsyncHandler<Void>() {
                      @Override
                      public void handle(Void result) {
                          handler.end();
                      }
                  });
              }
  
              previousHandler = handler;
          }
  
          IReadWriteStream<H> tailPolicyHandler = previousHandler;
  
          // If no policy handlers were found, then just make ourselves the head,
          // otherwise connect the last policy handler in the chain to ourselves
          // Leave the head and tail policy handlers null - the write() and end() methods
          // will deal with that case.
          if (headPolicyHandler != null && tailPolicyHandler != null) {
              tailPolicyHandler.bodyHandler(new IAsyncHandler<IApimanBuffer>() {
  
                  @Override
                  public void handle(IApimanBuffer chunk) {
                      handleBody(chunk);
                  }
              });
  
              tailPolicyHandler.endHandler(new IAsyncHandler<Void>() {
  
                  @Override
                  public void handle(Void result) {
                      handleEnd();
                  }
              });
          }
      }
docs: Chain together the body handlers.