/** Returns the {@link String} representation of this pipeline. */
  @Override
  public String toString() {
    StringBuilder buf = new StringBuilder();
    buf.append(getClass().getSimpleName());
    buf.append('{');
    DefaultChannelHandlerContext ctx = head.next;
    for (; ; ) {
      if (ctx == tail) {
        break;
      }

      buf.append('(');
      buf.append(ctx.name());
      buf.append(" = ");
      buf.append(ctx.handler().getClass().getName());
      buf.append(')');

      ctx = ctx.next;
      if (ctx == tail) {
        break;
      }

      buf.append(", ");
    }
    buf.append('}');
    return buf.toString();
  }
 private static String generateName(ChannelHandler handler) {
   String type = handler.getClass().getSimpleName();
   StringBuilder buf = new StringBuilder(type.length() + 10);
   buf.append(type);
   buf.append("-0");
   buf.append(Long.toHexString(System.identityHashCode(handler) & 0xFFFFFFFFL | 0x100000000L));
   buf.setCharAt(buf.length() - 9, 'x');
   return buf.toString();
 }