@Override
    public CookieSpec create(final HttpContext context) {
        if (cookieSpec == null) {
            lock.lock();
            try {
                if (cookieSpec == null) {
                    switch (this.compatibilityLevel) {
                        case STRICT:
                            this.cookieSpec = new RFC6265StrictSpec(
                                    BasicPathHandler.INSTANCE,
                                    PublicSuffixDomainFilter.decorate(
                                            BasicDomainHandler.INSTANCE, this.publicSuffixMatcher),
                                    BasicMaxAgeHandler.INSTANCE,
                                    BasicSecureHandler.INSTANCE,
                                    BasicHttpOnlyHandler.INSTANCE,
                                    new BasicExpiresHandler(DateUtils.STANDARD_PATTERNS));
                            break;
                        case IE_MEDIUM_SECURITY:
                            this.cookieSpec = new RFC6265LaxSpec(
                                    new BasicPathHandler() {
                                        @Override
                                        public void validate(
                                                final Cookie cookie,
                                                final CookieOrigin origin) throws MalformedCookieException {
                                            // No validation
                                        }
                                    },
                                    PublicSuffixDomainFilter.decorate(
                                            BasicDomainHandler.INSTANCE, this.publicSuffixMatcher),
                                    BasicMaxAgeHandler.INSTANCE,
                                    BasicSecureHandler.INSTANCE,
                                    BasicHttpOnlyHandler.INSTANCE,
                                    new BasicExpiresHandler(DateUtils.STANDARD_PATTERNS));
                            break;
                        default:
                            this.cookieSpec = new RFC6265LaxSpec(
                                    BasicPathHandler.INSTANCE,
                                    PublicSuffixDomainFilter.decorate(
                                            BasicDomainHandler.INSTANCE, this.publicSuffixMatcher),
                                    LaxMaxAgeHandler.INSTANCE,
                                    BasicSecureHandler.INSTANCE,
                                    LaxExpiresHandler.INSTANCE);
                    }
                }
            } finally {
                lock.unlock();
            }
        }
        return this.cookieSpec;
    }
{@link CookieSpecFactory} implementation that provides an instance of
RFC 6265 conformant cookie policy. The instance returned by this factory
can be shared by multiple threads.

@since 4.4
httpclient5/src/main/java/org/apache/hc/client5/http/impl/cookie/RFC6265CookieSpecFactory.java