@Override
    public List<Cookie> getCookies() {
        lock.readLock().lock();
        try {
            //create defensive copy so it won't be concurrently modified
            return new ArrayList<>(cookies);
        } finally {
            lock.readLock().unlock();
        }
    }
Returns an immutable array of {@link Cookie cookies} that this HTTP
state currently contains.

@return an array of {@link Cookie cookies}.
httpclient5/src/main/java/org/apache/hc/client5/http/cookie/BasicCookieStore.java