code: public Short getAvailableRefIndex(boolean consumerToProvider) {
          if (headerCache == null) {
              synchronized (this) {
                  if (headerCache == null) {
                      headerCache = new TwoWayMap<Short, String>();
                  }
              }
          }
          if (consumerToProvider) { // from consumer to provider : 0~32766
              for (short i = 0; i < Short.MAX_VALUE; i++) {
                  if (!headerCache.containsKey(i)) {
                      return i;
                  }
              }
          } else { // from provider to consumer : -1~-32767
              for (short i = -1; i > Short.MIN_VALUE; i--) {
                  if (!headerCache.containsKey(i)) {
                      return i;
                  }
              }
          }
          return null;
      }
docs: 得到可用的引用索引
  
  @param consumerToProvider 客户端发起true、还是服务端发起false
  @return 可用的引用索引