docs: @SuppressWarnings("unchecked")
      public static <T extends StatefulConnection<?, ?>> GenericObjectPool<T> createGenericObjectPool(
              Supplier<T> connectionSupplier, GenericObjectPoolConfig<T> config, boolean wrapConnections) {
  
          LettuceAssert.notNull(connectionSupplier, "Connection supplier must not be null");
          LettuceAssert.notNull(config, "GenericObjectPoolConfig must not be null");
  
          AtomicReference<Origin<T>> poolRef = new AtomicReference<>();
  
          GenericObjectPool<T> pool = new GenericObjectPool<T>(new RedisPooledObjectFactory<T>(connectionSupplier), config) {
  
              @Override
              public T borrowObject() throws Exception {
                  return wrapConnections ? ConnectionWrapping.wrapConnection(super.borrowObject(), poolRef.get()) : super
                          .borrowObject();
              }
  
              @Override
              public void returnObject(T obj) {
  
                  if (wrapConnections && obj instanceof HasTargetConnection) {
                      super.returnObject((T) ((HasTargetConnection) obj).getTargetConnection());
                      return;
                  }
                  super.returnObject(obj);
              }
          };
  
          poolRef.set(new ObjectPoolWrapper<>(pool));
  
          return pool;
      }