[httpcomponents-client] 01/10: Add httpcore-ThreadSafe.patch and fix FTBFS due to removal of annotation

Markus Koschany apo at moszumanska.debian.org
Thu Jul 14 21:27:58 UTC 2016


This is an automated email from the git hooks/post-receive script.

apo pushed a commit to branch master
in repository httpcomponents-client.

commit aef307f267f4d83534ab05225f4c1df0236ac72f
Author: Markus Koschany <apo at debian.org>
Date:   Thu Jul 14 22:56:11 2016 +0200

    Add httpcore-ThreadSafe.patch and fix FTBFS due to removal of annotation
    
    classes in libhttpcore-java.
    
    Closes: #828206
    Thanks: Daniel Schepler for the report.
---
 debian/patches/01-generate_osgi_metadata.patch |    6 +-
 debian/patches/httpcore-ThreadSafe.patch       | 5650 ++++++++++++++++++++++++
 debian/patches/series                          |    1 +
 3 files changed, 5655 insertions(+), 2 deletions(-)

diff --git a/debian/patches/01-generate_osgi_metadata.patch b/debian/patches/01-generate_osgi_metadata.patch
index 13c2e22..952ec44 100644
--- a/debian/patches/01-generate_osgi_metadata.patch
+++ b/debian/patches/01-generate_osgi_metadata.patch
@@ -3,9 +3,11 @@ Date: Wed, 28 Mar 2012 22:20:33 +0200
 Subject: generate-osgi-metadata
 
 ---
- httpclient/pom.xml |   39 ++++++++++++++++++++++++++++++++-------
- 1 file changed, 32 insertions(+), 7 deletions(-)
+ httpclient/pom.xml | 27 ++++++++++++++++++++++++++-
+ 1 file changed, 26 insertions(+), 1 deletion(-)
 
+diff --git a/httpclient/pom.xml b/httpclient/pom.xml
+index 32c5cb4..e076406 100644
 --- a/httpclient/pom.xml
 +++ b/httpclient/pom.xml
 @@ -117,13 +117,38 @@
diff --git a/debian/patches/httpcore-ThreadSafe.patch b/debian/patches/httpcore-ThreadSafe.patch
new file mode 100644
index 0000000..297e499
--- /dev/null
+++ b/debian/patches/httpcore-ThreadSafe.patch
@@ -0,0 +1,5650 @@
+From: Markus Koschany <apo at debian.org>
+Date: Thu, 14 Jul 2016 22:55:45 +0200
+Subject: httpcore ThreadSafe
+
+---
+ .../org/apache/http/impl/client/cache/CachingHttpClient.java  |  5 +++--
+ .../java/org/apache/http/client/cache/HeaderConstants.java    |  5 +++--
+ .../java/org/apache/http/client/cache/HttpCacheEntry.java     |  5 +++--
+ .../apache/http/impl/client/cache/BasicHttpCacheStorage.java  |  5 +++--
+ .../org/apache/http/impl/client/cache/BasicIdGenerator.java   |  5 +++--
+ .../java/org/apache/http/impl/client/cache/CacheEntity.java   |  5 +++--
+ .../org/apache/http/impl/client/cache/CacheEntryUpdater.java  |  5 +++--
+ .../org/apache/http/impl/client/cache/CacheInvalidator.java   |  5 +++--
+ .../org/apache/http/impl/client/cache/CacheKeyGenerator.java  |  5 +++--
+ .../apache/http/impl/client/cache/CacheValidityPolicy.java    |  5 +++--
+ .../apache/http/impl/client/cache/CacheableRequestPolicy.java |  5 +++--
+ .../http/impl/client/cache/CachedHttpResponseGenerator.java   |  5 +++--
+ .../impl/client/cache/CachedResponseSuitabilityChecker.java   |  5 +++--
+ .../java/org/apache/http/impl/client/cache/CachingExec.java   |  5 +++--
+ .../org/apache/http/impl/client/cache/CachingHttpClients.java |  5 +++--
+ .../http/impl/client/cache/ConditionalRequestBuilder.java     |  5 +++--
+ .../apache/http/impl/client/cache/DefaultFailureCache.java    |  5 +++--
+ .../impl/client/cache/DefaultHttpCacheEntrySerializer.java    |  5 +++--
+ .../client/cache/ExponentialBackOffSchedulingStrategy.java    |  5 +++--
+ .../org/apache/http/impl/client/cache/FailureCacheValue.java  |  5 +++--
+ .../java/org/apache/http/impl/client/cache/FileResource.java  |  5 +++--
+ .../apache/http/impl/client/cache/FileResourceFactory.java    |  5 +++--
+ .../java/org/apache/http/impl/client/cache/HeapResource.java  |  5 +++--
+ .../apache/http/impl/client/cache/HeapResourceFactory.java    |  5 +++--
+ .../main/java/org/apache/http/impl/client/cache/IOUtils.java  |  5 +++--
+ .../http/impl/client/cache/ImmediateSchedulingStrategy.java   |  5 +++--
+ .../http/impl/client/cache/ManagedHttpCacheStorage.java       |  5 +++--
+ .../apache/http/impl/client/cache/OptionsHttp11Response.java  |  5 +++--
+ .../http/impl/client/cache/RequestProtocolCompliance.java     |  5 +++--
+ .../org/apache/http/impl/client/cache/ResourceReference.java  |  5 +++--
+ .../apache/http/impl/client/cache/ResponseCachingPolicy.java  |  5 +++--
+ .../http/impl/client/cache/ResponseProtocolCompliance.java    |  5 +++--
+ .../apache/http/impl/auth/win/CurrentWindowsCredentials.java  |  5 +++--
+ .../apache/http/impl/auth/win/WindowsCredentialsProvider.java |  5 +++--
+ .../apache/http/impl/auth/win/WindowsNTLMSchemeFactory.java   |  5 +++--
+ .../http/impl/auth/win/WindowsNegotiateSchemeFactory.java     |  5 +++--
+ .../org/apache/http/auth/params/AuthParams.java               |  5 +++--
+ .../org/apache/http/client/params/AuthPolicy.java             |  5 +++--
+ .../org/apache/http/client/params/CookiePolicy.java           |  5 +++--
+ .../org/apache/http/client/params/HttpClientParams.java       |  5 +++--
+ .../http/client/protocol/RequestProxyAuthentication.java      |  5 +++--
+ .../http/client/protocol/RequestTargetAuthentication.java     |  5 +++--
+ .../org/apache/http/client/protocol/ResponseAuthCache.java    |  5 +++--
+ .../java-deprecated/org/apache/http/client/utils/JdkIdn.java  |  5 +++--
+ .../org/apache/http/client/utils/Punycode.java                |  5 +++--
+ .../org/apache/http/client/utils/Rfc3492Idn.java              |  5 +++--
+ .../org/apache/http/conn/MultihomePlainSocketFactory.java     |  5 +++--
+ .../org/apache/http/conn/params/ConnManagerParams.java        |  5 +++--
+ .../org/apache/http/conn/params/ConnPerRouteBean.java         |  5 +++--
+ .../org/apache/http/conn/params/ConnRouteParams.java          |  5 +++--
+ .../org/apache/http/conn/scheme/PlainSocketFactory.java       |  5 +++--
+ .../java-deprecated/org/apache/http/conn/ssl/SSLContexts.java |  5 +++--
+ .../org/apache/http/conn/ssl/SSLSocketFactory.java            |  5 +++--
+ .../http/impl/client/AbstractAuthenticationHandler.java       |  5 +++--
+ .../org/apache/http/impl/client/AbstractHttpClient.java       |  5 +++--
+ .../http/impl/client/AuthenticationStrategyAdaptor.java       |  5 +++--
+ .../org/apache/http/impl/client/AutoRetryHttpClient.java      |  5 +++--
+ .../apache/http/impl/client/ContentEncodingHttpClient.java    |  5 +++--
+ .../org/apache/http/impl/client/DefaultHttpClient.java        |  5 +++--
+ .../http/impl/client/DefaultProxyAuthenticationHandler.java   |  5 +++--
+ .../org/apache/http/impl/client/DefaultRedirectHandler.java   |  5 +++--
+ .../http/impl/client/DefaultRedirectStrategyAdaptor.java      |  5 +++--
+ .../http/impl/client/DefaultTargetAuthenticationHandler.java  |  5 +++--
+ .../org/apache/http/impl/client/RoutedRequest.java            |  2 +-
+ .../org/apache/http/impl/client/SystemDefaultHttpClient.java  |  5 +++--
+ .../org/apache/http/impl/client/TunnelRefusedException.java   |  5 +++--
+ .../apache/http/impl/conn/BasicClientConnectionManager.java   |  5 +++--
+ .../http/impl/conn/DefaultClientConnectionOperator.java       |  7 ++++---
+ .../org/apache/http/impl/conn/DefaultHttpRoutePlanner.java    |  7 ++++---
+ .../org/apache/http/impl/conn/DefaultResponseParser.java      |  5 +++--
+ .../org/apache/http/impl/conn/LoggingSessionInputBuffer.java  |  5 +++--
+ .../org/apache/http/impl/conn/LoggingSessionOutputBuffer.java |  5 +++--
+ .../apache/http/impl/conn/PoolingClientConnectionManager.java |  5 +++--
+ .../org/apache/http/impl/conn/ProxySelectorRoutePlanner.java  |  2 +-
+ .../org/apache/http/impl/conn/SchemeRegistryFactory.java      |  5 +++--
+ .../org/apache/http/impl/conn/SingleClientConnManager.java    |  5 +++--
+ .../org/apache/http/impl/conn/tsccm/BasicPoolEntryRef.java    |  2 +-
+ .../http/impl/conn/tsccm/ThreadSafeClientConnManager.java     | 11 ++++++-----
+ .../org/apache/http/impl/cookie/BestMatchSpec.java            |  5 +++--
+ .../org/apache/http/impl/cookie/BestMatchSpecFactory.java     |  5 +++--
+ .../org/apache/http/impl/cookie/BrowserCompatSpec.java        |  5 +++--
+ .../org/apache/http/impl/cookie/BrowserCompatSpecFactory.java |  5 +++--
+ .../impl/cookie/BrowserCompatVersionAttributeHandler.java     |  5 +++--
+ .../org/apache/http/impl/cookie/DateParseException.java       |  5 +++--
+ .../org/apache/http/impl/cookie/DateUtils.java                |  5 +++--
+ .../org/apache/http/impl/cookie/IgnoreSpecFactory.java        |  5 +++--
+ .../org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java |  5 +++--
+ .../org/apache/http/impl/cookie/PublicSuffixListParser.java   |  5 +++--
+ .../org/apache/http/impl/cookie/RFC2109SpecFactory.java       |  5 +++--
+ .../org/apache/http/impl/cookie/RFC2965SpecFactory.java       |  5 +++--
+ httpclient/src/main/java/org/apache/http/auth/AUTH.java       |  5 +++--
+ httpclient/src/main/java/org/apache/http/auth/AuthOption.java |  5 +++--
+ .../main/java/org/apache/http/auth/AuthSchemeRegistry.java    |  5 +++--
+ httpclient/src/main/java/org/apache/http/auth/AuthScope.java  |  5 +++--
+ .../java/org/apache/http/auth/AuthenticationException.java    |  5 +++--
+ .../main/java/org/apache/http/auth/BasicUserPrincipal.java    |  5 +++--
+ .../org/apache/http/auth/InvalidCredentialsException.java     |  5 +++--
+ .../main/java/org/apache/http/auth/KerberosCredentials.java   |  5 +++--
+ .../org/apache/http/auth/MalformedChallengeException.java     |  5 +++--
+ .../src/main/java/org/apache/http/auth/NTCredentials.java     |  5 +++--
+ .../src/main/java/org/apache/http/auth/NTUserPrincipal.java   |  5 +++--
+ .../org/apache/http/auth/UsernamePasswordCredentials.java     |  5 +++--
+ .../org/apache/http/client/CircularRedirectException.java     |  5 +++--
+ .../java/org/apache/http/client/ClientProtocolException.java  |  5 +++--
+ .../java/org/apache/http/client/HttpResponseException.java    |  5 +++--
+ .../org/apache/http/client/NonRepeatableRequestException.java |  5 +++--
+ .../main/java/org/apache/http/client/RedirectException.java   |  5 +++--
+ .../main/java/org/apache/http/client/config/AuthSchemes.java  |  5 +++--
+ .../main/java/org/apache/http/client/config/CookieSpecs.java  |  5 +++--
+ .../java/org/apache/http/client/config/RequestConfig.java     |  5 +++--
+ .../apache/http/client/protocol/RequestAcceptEncoding.java    |  5 +++--
+ .../org/apache/http/client/protocol/RequestAddCookies.java    |  5 +++--
+ .../org/apache/http/client/protocol/RequestAuthCache.java     |  5 +++--
+ .../apache/http/client/protocol/RequestClientConnControl.java |  5 +++--
+ .../apache/http/client/protocol/RequestDefaultHeaders.java    |  5 +++--
+ .../apache/http/client/protocol/RequestExpectContinue.java    |  5 +++--
+ .../apache/http/client/protocol/ResponseContentEncoding.java  |  5 +++--
+ .../apache/http/client/protocol/ResponseProcessCookies.java   |  5 +++--
+ .../main/java/org/apache/http/client/utils/CloneUtils.java    |  5 +++--
+ .../src/main/java/org/apache/http/client/utils/DateUtils.java |  5 +++--
+ .../src/main/java/org/apache/http/client/utils/URIUtils.java  |  5 +++--
+ .../java/org/apache/http/client/utils/URLEncodedUtils.java    |  5 +++--
+ .../java/org/apache/http/conn/ConnectTimeoutException.java    |  5 +++--
+ .../org/apache/http/conn/ConnectionPoolTimeoutException.java  |  5 +++--
+ .../java/org/apache/http/conn/HttpHostConnectException.java   |  5 +++--
+ .../java/org/apache/http/conn/UnsupportedSchemeException.java |  5 +++--
+ .../java/org/apache/http/conn/routing/BasicRouteDirector.java |  5 +++--
+ .../src/main/java/org/apache/http/conn/routing/HttpRoute.java |  5 +++--
+ .../src/main/java/org/apache/http/conn/scheme/Scheme.java     |  5 +++--
+ .../main/java/org/apache/http/conn/scheme/SchemeRegistry.java |  5 +++--
+ .../apache/http/conn/socket/PlainConnectionSocketFactory.java |  5 +++--
+ .../org/apache/http/conn/ssl/AllowAllHostnameVerifier.java    |  5 +++--
+ .../apache/http/conn/ssl/BrowserCompatHostnameVerifier.java   |  5 +++--
+ .../org/apache/http/conn/ssl/DefaultHostnameVerifier.java     |  5 +++--
+ .../java/org/apache/http/conn/ssl/NoopHostnameVerifier.java   |  5 +++--
+ .../org/apache/http/conn/ssl/SSLConnectionSocketFactory.java  |  5 +++--
+ .../java/org/apache/http/conn/ssl/StrictHostnameVerifier.java |  5 +++--
+ .../main/java/org/apache/http/conn/util/InetAddressUtils.java |  5 +++--
+ .../main/java/org/apache/http/conn/util/PublicSuffixList.java |  5 +++--
+ .../org/apache/http/conn/util/PublicSuffixListParser.java     |  5 +++--
+ .../java/org/apache/http/conn/util/PublicSuffixMatcher.java   |  5 +++--
+ .../org/apache/http/conn/util/PublicSuffixMatcherLoader.java  |  5 +++--
+ .../java/org/apache/http/cookie/CookieIdentityComparator.java |  5 +++--
+ .../src/main/java/org/apache/http/cookie/CookieOrigin.java    |  5 +++--
+ .../java/org/apache/http/cookie/CookiePathComparator.java     |  5 +++--
+ .../java/org/apache/http/cookie/CookiePriorityComparator.java |  5 +++--
+ .../http/cookie/CookieRestrictionViolationException.java      |  5 +++--
+ .../main/java/org/apache/http/cookie/CookieSpecRegistry.java  |  5 +++--
+ .../java/org/apache/http/cookie/MalformedCookieException.java |  5 +++--
+ .../java/org/apache/http/impl/auth/BasicSchemeFactory.java    |  5 +++--
+ .../java/org/apache/http/impl/auth/DigestSchemeFactory.java   |  5 +++--
+ .../java/org/apache/http/impl/auth/KerberosSchemeFactory.java |  5 +++--
+ .../java/org/apache/http/impl/auth/NTLMEngineException.java   |  5 +++--
+ .../java/org/apache/http/impl/auth/NTLMSchemeFactory.java     |  5 +++--
+ .../java/org/apache/http/impl/auth/SPNegoSchemeFactory.java   |  5 +++--
+ .../http/impl/auth/UnsupportedDigestAlgorithmException.java   |  5 +++--
+ .../org/apache/http/impl/client/AbstractResponseHandler.java  |  5 +++--
+ .../apache/http/impl/client/AuthenticationStrategyImpl.java   |  5 +++--
+ .../main/java/org/apache/http/impl/client/BasicAuthCache.java |  5 +++--
+ .../java/org/apache/http/impl/client/BasicCookieStore.java    |  5 +++--
+ .../org/apache/http/impl/client/BasicCredentialsProvider.java |  5 +++--
+ .../org/apache/http/impl/client/BasicResponseHandler.java     |  5 +++--
+ .../java/org/apache/http/impl/client/CloseableHttpClient.java |  5 +++--
+ .../http/impl/client/DefaultConnectionKeepAliveStrategy.java  |  5 +++--
+ .../http/impl/client/DefaultHttpRequestRetryHandler.java      |  5 +++--
+ .../org/apache/http/impl/client/DefaultRedirectStrategy.java  |  5 +++--
+ .../impl/client/DefaultServiceUnavailableRetryStrategy.java   |  5 +++--
+ .../org/apache/http/impl/client/DefaultUserTokenHandler.java  |  5 +++--
+ .../http/impl/client/FutureRequestExecutionService.java       |  5 +++--
+ .../main/java/org/apache/http/impl/client/HttpClients.java    |  5 +++--
+ .../java/org/apache/http/impl/client/InternalHttpClient.java  |  5 +++--
+ .../java/org/apache/http/impl/client/LaxRedirectStrategy.java |  5 +++--
+ .../java/org/apache/http/impl/client/MinimalHttpClient.java   |  5 +++--
+ .../org/apache/http/impl/client/NoopUserTokenHandler.java     |  5 +++--
+ .../apache/http/impl/client/ProxyAuthenticationStrategy.java  |  5 +++--
+ .../http/impl/client/StandardHttpRequestRetryHandler.java     |  5 +++--
+ .../http/impl/client/SystemDefaultCredentialsProvider.java    |  5 +++--
+ .../apache/http/impl/client/TargetAuthenticationStrategy.java |  5 +++--
+ .../http/impl/conn/BasicHttpClientConnectionManager.java      |  5 +++--
+ httpclient/src/main/java/org/apache/http/impl/conn/CPool.java |  5 +++--
+ .../src/main/java/org/apache/http/impl/conn/CPoolEntry.java   |  5 +++--
+ .../apache/http/impl/conn/ConnectionShutdownException.java    |  5 +++--
+ .../http/impl/conn/DefaultHttpClientConnectionOperator.java   |  5 +++--
+ .../http/impl/conn/DefaultHttpResponseParserFactory.java      |  5 +++--
+ .../org/apache/http/impl/conn/DefaultProxyRoutePlanner.java   |  5 +++--
+ .../java/org/apache/http/impl/conn/DefaultRoutePlanner.java   |  5 +++--
+ .../org/apache/http/impl/conn/DefaultSchemePortResolver.java  |  5 +++--
+ .../http/impl/conn/ManagedHttpClientConnectionFactory.java    |  5 +++--
+ .../http/impl/conn/PoolingHttpClientConnectionManager.java    |  5 +++--
+ .../org/apache/http/impl/conn/SystemDefaultRoutePlanner.java  |  5 +++--
+ httpclient/src/main/java/org/apache/http/impl/conn/Wire.java  |  5 +++--
+ .../http/impl/cookie/AbstractCookieAttributeHandler.java      |  5 +++--
+ .../java/org/apache/http/impl/cookie/AbstractCookieSpec.java  |  5 +++--
+ .../java/org/apache/http/impl/cookie/BasicCommentHandler.java |  5 +++--
+ .../java/org/apache/http/impl/cookie/BasicDomainHandler.java  |  5 +++--
+ .../java/org/apache/http/impl/cookie/BasicExpiresHandler.java |  5 +++--
+ .../java/org/apache/http/impl/cookie/BasicMaxAgeHandler.java  |  5 +++--
+ .../java/org/apache/http/impl/cookie/BasicPathHandler.java    |  5 +++--
+ .../java/org/apache/http/impl/cookie/BasicSecureHandler.java  |  5 +++--
+ .../main/java/org/apache/http/impl/cookie/CookieSpecBase.java |  5 +++--
+ .../java/org/apache/http/impl/cookie/DefaultCookieSpec.java   |  5 +++--
+ .../apache/http/impl/cookie/DefaultCookieSpecProvider.java    |  5 +++--
+ .../src/main/java/org/apache/http/impl/cookie/IgnoreSpec.java |  5 +++--
+ .../java/org/apache/http/impl/cookie/IgnoreSpecProvider.java  |  5 +++--
+ .../java/org/apache/http/impl/cookie/LaxExpiresHandler.java   |  5 +++--
+ .../java/org/apache/http/impl/cookie/LaxMaxAgeHandler.java    |  5 +++--
+ .../org/apache/http/impl/cookie/NetscapeDomainHandler.java    |  5 +++--
+ .../apache/http/impl/cookie/NetscapeDraftHeaderParser.java    |  5 +++--
+ .../java/org/apache/http/impl/cookie/NetscapeDraftSpec.java   |  5 +++--
+ .../apache/http/impl/cookie/NetscapeDraftSpecProvider.java    |  5 +++--
+ .../org/apache/http/impl/cookie/PublicSuffixDomainFilter.java |  5 +++--
+ .../org/apache/http/impl/cookie/RFC2109DomainHandler.java     |  5 +++--
+ .../main/java/org/apache/http/impl/cookie/RFC2109Spec.java    |  5 +++--
+ .../java/org/apache/http/impl/cookie/RFC2109SpecProvider.java |  5 +++--
+ .../org/apache/http/impl/cookie/RFC2109VersionHandler.java    |  5 +++--
+ .../http/impl/cookie/RFC2965CommentUrlAttributeHandler.java   |  5 +++--
+ .../http/impl/cookie/RFC2965DiscardAttributeHandler.java      |  5 +++--
+ .../http/impl/cookie/RFC2965DomainAttributeHandler.java       |  5 +++--
+ .../apache/http/impl/cookie/RFC2965PortAttributeHandler.java  |  5 +++--
+ .../main/java/org/apache/http/impl/cookie/RFC2965Spec.java    |  5 +++--
+ .../java/org/apache/http/impl/cookie/RFC2965SpecProvider.java |  5 +++--
+ .../http/impl/cookie/RFC2965VersionAttributeHandler.java      |  5 +++--
+ .../java/org/apache/http/impl/cookie/RFC6265CookieSpec.java   |  5 +++--
+ .../apache/http/impl/cookie/RFC6265CookieSpecProvider.java    |  5 +++--
+ .../main/java/org/apache/http/impl/cookie/RFC6265LaxSpec.java |  5 +++--
+ .../java/org/apache/http/impl/cookie/RFC6265StrictSpec.java   |  5 +++--
+ .../org/apache/http/impl/execchain/BackoffStrategyExec.java   |  5 +++--
+ .../java/org/apache/http/impl/execchain/ConnectionHolder.java |  5 +++--
+ .../java/org/apache/http/impl/execchain/MainClientExec.java   |  5 +++--
+ .../org/apache/http/impl/execchain/MinimalClientExec.java     |  5 +++--
+ .../java/org/apache/http/impl/execchain/ProtocolExec.java     |  5 +++--
+ .../java/org/apache/http/impl/execchain/RedirectExec.java     |  5 +++--
+ .../apache/http/impl/execchain/RequestAbortedException.java   |  5 +++--
+ .../main/java/org/apache/http/impl/execchain/RetryExec.java   |  5 +++--
+ .../http/impl/execchain/ServiceUnavailableRetryExec.java      |  5 +++--
+ .../apache/http/impl/execchain/TunnelRefusedException.java    |  5 +++--
+ 236 files changed, 707 insertions(+), 474 deletions(-)
+
+diff --git a/httpclient-cache/src/main/java-deprecated/org/apache/http/impl/client/cache/CachingHttpClient.java b/httpclient-cache/src/main/java-deprecated/org/apache/http/impl/client/cache/CachingHttpClient.java
+index a54ff19..30383ba 100644
+--- a/httpclient-cache/src/main/java-deprecated/org/apache/http/impl/client/cache/CachingHttpClient.java
++++ b/httpclient-cache/src/main/java-deprecated/org/apache/http/impl/client/cache/CachingHttpClient.java
+@@ -57,7 +57,8 @@ import org.apache.http.HttpVersion;
+ import org.apache.http.ProtocolException;
+ import org.apache.http.ProtocolVersion;
+ import org.apache.http.RequestLine;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.ClientProtocolException;
+ import org.apache.http.client.HttpClient;
+ import org.apache.http.client.ResponseHandler;
+@@ -126,7 +127,7 @@ import org.apache.http.util.VersionInfo;
+  * @deprecated (4.3) use {@link CachingHttpClientBuilder} or {@link CachingHttpClients}.
+  */
+ @Deprecated
+- at ThreadSafe // So long as the responseCache implementation is threadsafe
++ at Contract(threading = ThreadingBehavior.SAFE) // So long as the responseCache implementation is threadsafe
+ public class CachingHttpClient implements HttpClient {
+ 
+     /**
+diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/HeaderConstants.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/HeaderConstants.java
+index 0a25f24..f6e30e5 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/client/cache/HeaderConstants.java
++++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/HeaderConstants.java
+@@ -26,13 +26,14 @@
+  */
+ package org.apache.http.client.cache;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Records static constants for various HTTP header names.
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class HeaderConstants {
+ 
+     public static final String GET_METHOD = "GET";
+diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java
+index d8bf81b..8ab31d1 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java
++++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java
+@@ -36,7 +36,8 @@ import org.apache.http.Header;
+ import org.apache.http.HeaderIterator;
+ import org.apache.http.ProtocolVersion;
+ import org.apache.http.StatusLine;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.utils.DateUtils;
+ import org.apache.http.message.HeaderGroup;
+ import org.apache.http.protocol.HTTP;
+@@ -51,7 +52,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class HttpCacheEntry implements Serializable {
+ 
+     private static final long serialVersionUID = -6300496422359477413L;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCacheStorage.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCacheStorage.java
+index 76a525c..74109a4 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCacheStorage.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCacheStorage.java
+@@ -28,7 +28,8 @@ package org.apache.http.impl.client.cache;
+ 
+ import java.io.IOException;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HttpCacheEntry;
+ import org.apache.http.client.cache.HttpCacheStorage;
+ import org.apache.http.client.cache.HttpCacheUpdateCallback;
+@@ -43,7 +44,7 @@ import org.apache.http.client.cache.HttpCacheUpdateCallback;
+  *
+  * @since 4.1
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class BasicHttpCacheStorage implements HttpCacheStorage {
+ 
+     private final CacheMap entries;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicIdGenerator.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicIdGenerator.java
+index 04236ab..e39f110 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicIdGenerator.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicIdGenerator.java
+@@ -34,12 +34,13 @@ import java.util.Formatter;
+ import java.util.Locale;
+ 
+ import org.apache.http.annotation.GuardedBy;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Should produce reasonably unique tokens.
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ class BasicIdGenerator {
+ 
+     private final String hostname;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java
+index 66e4af7..42a99e4 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java
+@@ -33,12 +33,13 @@ import java.io.Serializable;
+ 
+ import org.apache.http.Header;
+ import org.apache.http.HttpEntity;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HttpCacheEntry;
+ import org.apache.http.protocol.HTTP;
+ import org.apache.http.util.Args;
+ 
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class CacheEntity implements HttpEntity, Serializable {
+ 
+     private static final long serialVersionUID = -3467082284120936233L;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java
+index 4801b9d..ec013db 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java
+@@ -36,7 +36,8 @@ import java.util.ListIterator;
+ import org.apache.http.Header;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpStatus;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HeaderConstants;
+ import org.apache.http.client.cache.HttpCacheEntry;
+ import org.apache.http.client.cache.Resource;
+@@ -52,7 +53,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class CacheEntryUpdater {
+ 
+     private final ResourceFactory resourceFactory;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java
+index 57c2d91..e619537 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java
+@@ -37,7 +37,8 @@ import org.apache.http.Header;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpResponse;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HeaderConstants;
+ import org.apache.http.client.cache.HttpCacheEntry;
+ import org.apache.http.client.cache.HttpCacheInvalidator;
+@@ -51,7 +52,7 @@ import org.apache.http.protocol.HTTP;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class CacheInvalidator implements HttpCacheInvalidator {
+ 
+     private final HttpCacheStorage storage;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheKeyGenerator.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheKeyGenerator.java
+index 3d006d5..4b42f1a 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheKeyGenerator.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheKeyGenerator.java
+@@ -40,7 +40,8 @@ import org.apache.http.Header;
+ import org.apache.http.HeaderElement;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HeaderConstants;
+ import org.apache.http.client.cache.HttpCacheEntry;
+ import org.apache.http.client.utils.URIUtils;
+@@ -48,7 +49,7 @@ import org.apache.http.client.utils.URIUtils;
+ /**
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class CacheKeyGenerator {
+ 
+     private static final URI BASE_URI = URI.create("http://example.com/");
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java
+index 7690e8a..5482515 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java
+@@ -31,7 +31,8 @@ import java.util.Date;
+ import org.apache.http.Header;
+ import org.apache.http.HeaderElement;
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HeaderConstants;
+ import org.apache.http.client.cache.HttpCacheEntry;
+ import org.apache.http.client.utils.DateUtils;
+@@ -40,7 +41,7 @@ import org.apache.http.protocol.HTTP;
+ /**
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class CacheValidityPolicy {
+ 
+     public static final long MAX_AGE = 2147483648L;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheableRequestPolicy.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheableRequestPolicy.java
+index d787703..0c14c31 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheableRequestPolicy.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheableRequestPolicy.java
+@@ -33,7 +33,8 @@ import org.apache.http.HeaderElement;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpVersion;
+ import org.apache.http.ProtocolVersion;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HeaderConstants;
+ 
+ /**
+@@ -41,7 +42,7 @@ import org.apache.http.client.cache.HeaderConstants;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class CacheableRequestPolicy {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedHttpResponseGenerator.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedHttpResponseGenerator.java
+index f74a2e4..5b0d20a 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedHttpResponseGenerator.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedHttpResponseGenerator.java
+@@ -33,7 +33,8 @@ import org.apache.http.HttpEntity;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpStatus;
+ import org.apache.http.HttpVersion;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HeaderConstants;
+ import org.apache.http.client.cache.HttpCacheEntry;
+ import org.apache.http.client.methods.CloseableHttpResponse;
+@@ -48,7 +49,7 @@ import org.apache.http.protocol.HTTP;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class CachedHttpResponseGenerator {
+ 
+     private final CacheValidityPolicy validityStrategy;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java
+index e7c940c..00df74d 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java
+@@ -35,7 +35,8 @@ import org.apache.http.HeaderElement;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpStatus;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HeaderConstants;
+ import org.apache.http.client.cache.HttpCacheEntry;
+ import org.apache.http.client.utils.DateUtils;
+@@ -46,7 +47,7 @@ import org.apache.http.client.utils.DateUtils;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class CachedResponseSuitabilityChecker {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java
+index d9c63dd..00f6ac9 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java
+@@ -49,7 +49,8 @@ import org.apache.http.HttpVersion;
+ import org.apache.http.ProtocolException;
+ import org.apache.http.ProtocolVersion;
+ import org.apache.http.RequestLine;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.CacheResponseStatus;
+ import org.apache.http.client.cache.HeaderConstants;
+ import org.apache.http.client.cache.HttpCacheContext;
+@@ -99,7 +100,7 @@ import org.apache.http.util.VersionInfo;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe // So long as the responseCache implementation is threadsafe
++ at Contract(threading = ThreadingBehavior.SAFE) // So long as the responseCache implementation is threadsafe
+ public class CachingExec implements ClientExecChain {
+ 
+     private final static boolean SUPPORTS_RANGE_AND_CONTENT_RANGE_HEADERS = false;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClients.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClients.java
+index 35beb6d..9e8a4a5 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClients.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClients.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.client.cache;
+ 
+ import java.io.File;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.impl.client.CloseableHttpClient;
+ 
+ /**
+@@ -38,7 +39,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class CachingHttpClients {
+ 
+     private CachingHttpClients() {
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ConditionalRequestBuilder.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ConditionalRequestBuilder.java
+index 0f4bd09..50cafd7 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ConditionalRequestBuilder.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ConditionalRequestBuilder.java
+@@ -31,7 +31,8 @@ import java.util.Map;
+ import org.apache.http.Header;
+ import org.apache.http.HeaderElement;
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HeaderConstants;
+ import org.apache.http.client.cache.HttpCacheEntry;
+ import org.apache.http.client.methods.HttpRequestWrapper;
+@@ -39,7 +40,7 @@ import org.apache.http.client.methods.HttpRequestWrapper;
+ /**
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class ConditionalRequestBuilder {
+ 
+     /**
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultFailureCache.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultFailureCache.java
+index c0626fa..a96d847 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultFailureCache.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultFailureCache.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.client.cache;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ import java.util.Map;
+ import java.util.concurrent.ConcurrentHashMap;
+@@ -38,7 +39,7 @@ import java.util.concurrent.ConcurrentMap;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class DefaultFailureCache implements FailureCache {
+ 
+     static final int DEFAULT_MAX_SIZE = 1000;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java
+index f84501b..6b5e11e 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java
+@@ -32,7 +32,8 @@ import java.io.ObjectInputStream;
+ import java.io.ObjectOutputStream;
+ import java.io.OutputStream;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HttpCacheEntry;
+ import org.apache.http.client.cache.HttpCacheEntrySerializationException;
+ import org.apache.http.client.cache.HttpCacheEntrySerializer;
+@@ -45,7 +46,7 @@ import org.apache.http.client.cache.HttpCacheEntrySerializer;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultHttpCacheEntrySerializer implements HttpCacheEntrySerializer {
+ 
+     @Override
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ExponentialBackOffSchedulingStrategy.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ExponentialBackOffSchedulingStrategy.java
+index 21b644f..bd717a8 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ExponentialBackOffSchedulingStrategy.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ExponentialBackOffSchedulingStrategy.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.client.cache;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ 
+ import java.util.concurrent.ScheduledExecutorService;
+@@ -56,7 +57,7 @@ import java.util.concurrent.TimeUnit;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class ExponentialBackOffSchedulingStrategy implements SchedulingStrategy {
+ 
+     public static final long DEFAULT_BACK_OFF_RATE = 10;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FailureCacheValue.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FailureCacheValue.java
+index 98137ae..abeedf1 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FailureCacheValue.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FailureCacheValue.java
+@@ -26,14 +26,15 @@
+  */
+ package org.apache.http.impl.client.cache;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * The error count with a creation timestamp and its associated key.
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class FailureCacheValue {
+ 
+     private final long creationTimeInNanos;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResource.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResource.java
+index eef9c9a..e5d5d29 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResource.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResource.java
+@@ -31,7 +31,8 @@ import java.io.FileInputStream;
+ import java.io.IOException;
+ import java.io.InputStream;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.Resource;
+ 
+ /**
+@@ -39,7 +40,7 @@ import org.apache.http.client.cache.Resource;
+  *
+  * @since 4.1
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class FileResource implements Resource {
+ 
+     private static final long serialVersionUID = 4132244415919043397L;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java
+index f2c717c..2be72e1 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java
+@@ -31,7 +31,8 @@ import java.io.FileOutputStream;
+ import java.io.IOException;
+ import java.io.InputStream;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.InputLimit;
+ import org.apache.http.client.cache.Resource;
+ import org.apache.http.client.cache.ResourceFactory;
+@@ -41,7 +42,7 @@ import org.apache.http.client.cache.ResourceFactory;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class FileResourceFactory implements ResourceFactory {
+ 
+     private final File cacheDir;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResource.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResource.java
+index edf6b0f..b13c444 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResource.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResource.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.client.cache;
+ import java.io.ByteArrayInputStream;
+ import java.io.InputStream;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.Resource;
+ 
+ /**
+@@ -37,7 +38,7 @@ import org.apache.http.client.cache.Resource;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class HeapResource implements Resource {
+ 
+     private static final long serialVersionUID = -2078599905620463394L;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResourceFactory.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResourceFactory.java
+index 87a1b2a..ebad36e 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResourceFactory.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResourceFactory.java
+@@ -30,7 +30,8 @@ import java.io.ByteArrayOutputStream;
+ import java.io.IOException;
+ import java.io.InputStream;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.InputLimit;
+ import org.apache.http.client.cache.Resource;
+ import org.apache.http.client.cache.ResourceFactory;
+@@ -40,7 +41,7 @@ import org.apache.http.client.cache.ResourceFactory;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class HeapResourceFactory implements ResourceFactory {
+ 
+     @Override
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java
+index b255d0f..8cfe5f7 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java
+@@ -35,9 +35,10 @@ import java.io.RandomAccessFile;
+ import java.nio.channels.FileChannel;
+ 
+ import org.apache.http.HttpEntity;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class IOUtils {
+ 
+     static void consume(final HttpEntity entity) throws IOException {
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ImmediateSchedulingStrategy.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ImmediateSchedulingStrategy.java
+index 263c6b3..cc93957 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ImmediateSchedulingStrategy.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ImmediateSchedulingStrategy.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.client.cache;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ 
+ import java.util.concurrent.ArrayBlockingQueue;
+@@ -40,7 +41,7 @@ import java.util.concurrent.TimeUnit;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class ImmediateSchedulingStrategy implements SchedulingStrategy {
+ 
+     private final ExecutorService executor;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java
+index 0a02658..e87f7e5 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java
+@@ -33,7 +33,8 @@ import java.util.HashSet;
+ import java.util.Set;
+ import java.util.concurrent.atomic.AtomicBoolean;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HttpCacheEntry;
+ import org.apache.http.client.cache.HttpCacheStorage;
+ import org.apache.http.client.cache.HttpCacheUpdateCallback;
+@@ -70,7 +71,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.1
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class ManagedHttpCacheStorage implements HttpCacheStorage, Closeable {
+ 
+     private final CacheMap entries;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/OptionsHttp11Response.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/OptionsHttp11Response.java
+index 2245360..7f8e131 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/OptionsHttp11Response.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/OptionsHttp11Response.java
+@@ -36,7 +36,8 @@ import org.apache.http.HttpStatus;
+ import org.apache.http.HttpVersion;
+ import org.apache.http.ProtocolVersion;
+ import org.apache.http.StatusLine;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.message.AbstractHttpMessage;
+ import org.apache.http.message.BasicStatusLine;
+ import org.apache.http.params.BasicHttpParams;
+@@ -46,7 +47,7 @@ import org.apache.http.params.HttpParams;
+  * @since 4.1
+  */
+ @SuppressWarnings("deprecation")
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ final class OptionsHttp11Response extends AbstractHttpMessage implements HttpResponse {
+ 
+     private final StatusLine statusLine = new BasicStatusLine(HttpVersion.HTTP_1_1,
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/RequestProtocolCompliance.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/RequestProtocolCompliance.java
+index c74a607..af735e8 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/RequestProtocolCompliance.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/RequestProtocolCompliance.java
+@@ -38,7 +38,8 @@ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpStatus;
+ import org.apache.http.HttpVersion;
+ import org.apache.http.ProtocolVersion;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.ClientProtocolException;
+ import org.apache.http.client.cache.HeaderConstants;
+ import org.apache.http.client.methods.HttpRequestWrapper;
+@@ -52,7 +53,7 @@ import org.apache.http.protocol.HTTP;
+ /**
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class RequestProtocolCompliance {
+     private final boolean weakETagOnPutDeleteAllowed;
+ 
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResourceReference.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResourceReference.java
+index 4f9ac44..680b866 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResourceReference.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResourceReference.java
+@@ -29,12 +29,13 @@ package org.apache.http.impl.client.cache;
+ import java.lang.ref.PhantomReference;
+ import java.lang.ref.ReferenceQueue;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HttpCacheEntry;
+ import org.apache.http.client.cache.Resource;
+ import org.apache.http.util.Args;
+ 
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class ResourceReference extends PhantomReference<HttpCacheEntry> {
+ 
+     private final Resource resource;
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseCachingPolicy.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseCachingPolicy.java
+index ae7a08b..97b0777 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseCachingPolicy.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseCachingPolicy.java
+@@ -40,7 +40,8 @@ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpStatus;
+ import org.apache.http.HttpVersion;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.cache.HeaderConstants;
+ import org.apache.http.client.utils.DateUtils;
+ import org.apache.http.protocol.HTTP;
+@@ -50,7 +51,7 @@ import org.apache.http.protocol.HTTP;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class ResponseCachingPolicy {
+ 
+     private static final String[] AUTH_CACHEABLE_PARAMS = {
+diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java
+index bde392d..9e89ea2 100644
+--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java
++++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java
+@@ -39,7 +39,8 @@ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpStatus;
+ import org.apache.http.HttpVersion;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.ClientProtocolException;
+ import org.apache.http.client.cache.HeaderConstants;
+ import org.apache.http.client.methods.HttpRequestWrapper;
+@@ -50,7 +51,7 @@ import org.apache.http.protocol.HTTP;
+ /**
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ class ResponseProtocolCompliance {
+ 
+     private static final String UNEXPECTED_100_CONTINUE = "The incoming request did not contain a "
+diff --git a/httpclient-win/src/main/java/org/apache/http/impl/auth/win/CurrentWindowsCredentials.java b/httpclient-win/src/main/java/org/apache/http/impl/auth/win/CurrentWindowsCredentials.java
+index 8174992..5021e51 100644
+--- a/httpclient-win/src/main/java/org/apache/http/impl/auth/win/CurrentWindowsCredentials.java
++++ b/httpclient-win/src/main/java/org/apache/http/impl/auth/win/CurrentWindowsCredentials.java
+@@ -30,7 +30,8 @@ package org.apache.http.impl.auth.win;
+ import java.io.Serializable;
+ import java.security.Principal;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.Credentials;
+ 
+ import com.sun.jna.platform.win32.Secur32.EXTENDED_NAME_FORMAT;
+@@ -44,7 +45,7 @@ import com.sun.jna.platform.win32.Secur32Util;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class CurrentWindowsCredentials implements Credentials, Serializable, Principal {
+ 
+     private static final long serialVersionUID = 4361166468529298169L;
+diff --git a/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsCredentialsProvider.java b/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsCredentialsProvider.java
+index aae9e22..017468d 100644
+--- a/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsCredentialsProvider.java
++++ b/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsCredentialsProvider.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.auth.win;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScope;
+ import org.apache.http.auth.Credentials;
+ import org.apache.http.client.CredentialsProvider;
+@@ -43,7 +44,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.4
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class WindowsCredentialsProvider implements CredentialsProvider {
+ 
+     private final CredentialsProvider provider;
+diff --git a/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNTLMSchemeFactory.java b/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNTLMSchemeFactory.java
+index 21bed64..0f703ef 100644
+--- a/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNTLMSchemeFactory.java
++++ b/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNTLMSchemeFactory.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.auth.win;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthSchemeProvider;
+ import org.apache.http.client.config.AuthSchemes;
+@@ -42,7 +43,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class WindowsNTLMSchemeFactory implements AuthSchemeProvider {
+ 
+     private final String servicePrincipalName;
+diff --git a/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateSchemeFactory.java b/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateSchemeFactory.java
+index 29e5ffd..e0f793e 100644
+--- a/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateSchemeFactory.java
++++ b/httpclient-win/src/main/java/org/apache/http/impl/auth/win/WindowsNegotiateSchemeFactory.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.auth.win;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthSchemeProvider;
+ import org.apache.http.client.config.AuthSchemes;
+@@ -42,7 +43,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  *  @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class WindowsNegotiateSchemeFactory implements AuthSchemeProvider {
+ 
+     private final String servicePrincipalName;
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/auth/params/AuthParams.java b/httpclient/src/main/java-deprecated/org/apache/http/auth/params/AuthParams.java
+index a7de770..cd5efb6 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/auth/params/AuthParams.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/auth/params/AuthParams.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.auth.params;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.params.HttpParams;
+ import org.apache.http.protocol.HTTP;
+ import org.apache.http.util.Args;
+@@ -42,7 +43,7 @@ import org.apache.http.util.Args;
+  *   and constructor parameters of
+  *   {@link org.apache.http.auth.AuthSchemeProvider}s.
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public final class AuthParams {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/client/params/AuthPolicy.java b/httpclient/src/main/java-deprecated/org/apache/http/client/params/AuthPolicy.java
+index 768ddf9..b8ce0a4 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/client/params/AuthPolicy.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/client/params/AuthPolicy.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.client.params;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Standard authentication schemes supported by HttpClient.
+@@ -37,7 +38,7 @@ import org.apache.http.annotation.Immutable;
+  * @deprecated (4.3) use {@link org.apache.http.client.config.AuthSchemes}.
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class AuthPolicy {
+ 
+     private AuthPolicy() {
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/client/params/CookiePolicy.java b/httpclient/src/main/java-deprecated/org/apache/http/client/params/CookiePolicy.java
+index e12ab42..4672c3d 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/client/params/CookiePolicy.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/client/params/CookiePolicy.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.client.params;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Standard cookie specifications supported by HttpClient.
+@@ -37,7 +38,7 @@ import org.apache.http.annotation.Immutable;
+  * @deprecated (4.3) use {@link org.apache.http.client.config.CookieSpecs}.
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class CookiePolicy {
+ 
+     /**
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/client/params/HttpClientParams.java b/httpclient/src/main/java-deprecated/org/apache/http/client/params/HttpClientParams.java
+index c27cb7f..6953958 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/client/params/HttpClientParams.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/client/params/HttpClientParams.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.client.params;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.params.HttpConnectionParams;
+ import org.apache.http.params.HttpParams;
+ import org.apache.http.util.Args;
+@@ -39,7 +40,7 @@ import org.apache.http.util.Args;
+  * @deprecated (4.3) use {@link org.apache.http.client.config.RequestConfig}
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class HttpClientParams {
+ 
+     private HttpClientParams() {
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/client/protocol/RequestProxyAuthentication.java b/httpclient/src/main/java-deprecated/org/apache/http/client/protocol/RequestProxyAuthentication.java
+index b5ef5ad..6906547 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/client/protocol/RequestProxyAuthentication.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/client/protocol/RequestProxyAuthentication.java
+@@ -31,7 +31,8 @@ import java.io.IOException;
+ 
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AUTH;
+ import org.apache.http.auth.AuthState;
+ import org.apache.http.conn.HttpRoutedConnection;
+@@ -49,7 +50,7 @@ import org.apache.http.util.Args;
+  * @deprecated (4.3) use {@link org.apache.http.impl.auth.HttpAuthenticator}.
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RequestProxyAuthentication extends RequestAuthenticationBase {
+ 
+     public RequestProxyAuthentication() {
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/client/protocol/RequestTargetAuthentication.java b/httpclient/src/main/java-deprecated/org/apache/http/client/protocol/RequestTargetAuthentication.java
+index 263ff57..3df9360 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/client/protocol/RequestTargetAuthentication.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/client/protocol/RequestTargetAuthentication.java
+@@ -31,7 +31,8 @@ import java.io.IOException;
+ 
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AUTH;
+ import org.apache.http.auth.AuthState;
+ import org.apache.http.protocol.HttpContext;
+@@ -46,7 +47,7 @@ import org.apache.http.util.Args;
+  * @deprecated (4.3) use {@link org.apache.http.impl.auth.HttpAuthenticator}.
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RequestTargetAuthentication extends RequestAuthenticationBase {
+ 
+     public RequestTargetAuthentication() {
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/client/protocol/ResponseAuthCache.java b/httpclient/src/main/java-deprecated/org/apache/http/client/protocol/ResponseAuthCache.java
+index 23322e8..ab4778d 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/client/protocol/ResponseAuthCache.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/client/protocol/ResponseAuthCache.java
+@@ -35,7 +35,8 @@ import org.apache.http.HttpException;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpResponseInterceptor;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthState;
+ import org.apache.http.client.AuthCache;
+@@ -57,7 +58,7 @@ import org.apache.http.util.Args;
+  *
+  * @deprecated (4.2)  use {@link org.apache.http.client.AuthenticationStrategy}
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class ResponseAuthCache implements HttpResponseInterceptor {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/client/utils/JdkIdn.java b/httpclient/src/main/java-deprecated/org/apache/http/client/utils/JdkIdn.java
+index 99898b8..46fedeb 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/client/utils/JdkIdn.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/client/utils/JdkIdn.java
+@@ -29,7 +29,8 @@ package org.apache.http.client.utils;
+ import java.lang.reflect.InvocationTargetException;
+ import java.lang.reflect.Method;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Uses the java.net.IDN class through reflection.
+@@ -38,7 +39,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class JdkIdn implements Idn {
+     private final Method toUnicode;
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/client/utils/Punycode.java b/httpclient/src/main/java-deprecated/org/apache/http/client/utils/Punycode.java
+index 2d17f34..1a48c5a 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/client/utils/Punycode.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/client/utils/Punycode.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.client.utils;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Facade that provides conversion between Unicode and Punycode domain names.
+@@ -36,7 +37,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class Punycode {
+     private static final Idn impl;
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/client/utils/Rfc3492Idn.java b/httpclient/src/main/java-deprecated/org/apache/http/client/utils/Rfc3492Idn.java
+index 29dabc4..c415e40 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/client/utils/Rfc3492Idn.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/client/utils/Rfc3492Idn.java
+@@ -28,7 +28,8 @@ package org.apache.http.client.utils;
+ 
+ import java.util.StringTokenizer;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Implementation from pseudo code in RFC 3492.
+@@ -37,7 +38,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class Rfc3492Idn implements Idn {
+     private static final int base = 36;
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/conn/MultihomePlainSocketFactory.java b/httpclient/src/main/java-deprecated/org/apache/http/conn/MultihomePlainSocketFactory.java
+index 7ce6e05..15efa24 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/conn/MultihomePlainSocketFactory.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/conn/MultihomePlainSocketFactory.java
+@@ -37,7 +37,8 @@ import java.util.Arrays;
+ import java.util.Collections;
+ import java.util.List;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.scheme.SocketFactory;
+ import org.apache.http.params.HttpConnectionParams;
+ import org.apache.http.params.HttpParams;
+@@ -57,7 +58,7 @@ import org.apache.http.util.Asserts;
+  * {@link org.apache.http.conn.scheme.SchemeSocketFactory} interface.
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class MultihomePlainSocketFactory implements SocketFactory {
+ 
+     /**
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/conn/params/ConnManagerParams.java b/httpclient/src/main/java-deprecated/org/apache/http/conn/params/ConnManagerParams.java
+index 3c4ddfb..3088c78 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/conn/params/ConnManagerParams.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/conn/params/ConnManagerParams.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.conn.params;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.routing.HttpRoute;
+ import org.apache.http.params.HttpParams;
+ import org.apache.http.util.Args;
+@@ -42,7 +43,7 @@ import org.apache.http.util.Args;
+  * @deprecated (4.1) use configuration methods of the specific connection manager implementation.
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class ConnManagerParams implements ConnManagerPNames {
+ 
+     /** The default maximum number of connections allowed overall */
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/conn/params/ConnPerRouteBean.java b/httpclient/src/main/java-deprecated/org/apache/http/conn/params/ConnPerRouteBean.java
+index 241424f..7fed2b6 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/conn/params/ConnPerRouteBean.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/conn/params/ConnPerRouteBean.java
+@@ -29,7 +29,8 @@ package org.apache.http.conn.params;
+ import java.util.Map;
+ import java.util.concurrent.ConcurrentHashMap;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.routing.HttpRoute;
+ import org.apache.http.util.Args;
+ 
+@@ -44,7 +45,7 @@ import org.apache.http.util.Args;
+  * @deprecated (4.2)  use {@link org.apache.http.pool.ConnPoolControl}
+  */
+ @Deprecated
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public final class ConnPerRouteBean implements ConnPerRoute {
+ 
+     /** The default maximum number of connections allowed per host */
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/conn/params/ConnRouteParams.java b/httpclient/src/main/java-deprecated/org/apache/http/conn/params/ConnRouteParams.java
+index c4a9bc1..a366593 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/conn/params/ConnRouteParams.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/conn/params/ConnRouteParams.java
+@@ -29,7 +29,8 @@ package org.apache.http.conn.params;
+ import java.net.InetAddress;
+ 
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.routing.HttpRoute;
+ import org.apache.http.params.HttpParams;
+ import org.apache.http.util.Args;
+@@ -43,7 +44,7 @@ import org.apache.http.util.Args;
+  * @deprecated (4.3) use {@link org.apache.http.client.config.RequestConfig}.
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class ConnRouteParams implements ConnRoutePNames {
+ 
+     /**
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/conn/scheme/PlainSocketFactory.java b/httpclient/src/main/java-deprecated/org/apache/http/conn/scheme/PlainSocketFactory.java
+index a6973b1..1ed3bc6 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/conn/scheme/PlainSocketFactory.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/conn/scheme/PlainSocketFactory.java
+@@ -34,7 +34,8 @@ import java.net.Socket;
+ import java.net.SocketTimeoutException;
+ import java.net.UnknownHostException;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.ConnectTimeoutException;
+ import org.apache.http.params.HttpConnectionParams;
+ import org.apache.http.params.HttpParams;
+@@ -47,7 +48,7 @@ import org.apache.http.util.Args;
+  *
+  * @deprecated (4.3) use {@link org.apache.http.conn.socket.PlainConnectionSocketFactory}
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class PlainSocketFactory implements SocketFactory, SchemeSocketFactory {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/conn/ssl/SSLContexts.java b/httpclient/src/main/java-deprecated/org/apache/http/conn/ssl/SSLContexts.java
+index 26ab3e5..80863c4 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/conn/ssl/SSLContexts.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/conn/ssl/SSLContexts.java
+@@ -32,7 +32,8 @@ import java.security.NoSuchAlgorithmException;
+ 
+ import javax.net.ssl.SSLContext;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * {@link SSLContext} factory methods.
+@@ -41,7 +42,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @deprecated (4.4) use {@link org.apache.http.ssl.SSLContexts}.
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class SSLContexts {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/conn/ssl/SSLSocketFactory.java b/httpclient/src/main/java-deprecated/org/apache/http/conn/ssl/SSLSocketFactory.java
+index 37f539c..dc8deb7 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/conn/ssl/SSLSocketFactory.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/conn/ssl/SSLSocketFactory.java
+@@ -43,7 +43,8 @@ import javax.net.ssl.SSLContext;
+ import javax.net.ssl.SSLSocket;
+ 
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.ConnectTimeoutException;
+ import org.apache.http.conn.HttpInetSocketAddress;
+ import org.apache.http.conn.scheme.HostNameResolver;
+@@ -139,7 +140,7 @@ import org.apache.http.util.TextUtils;
+  *
+  * @deprecated (4.3) use {@link SSLConnectionSocketFactory}.
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public class SSLSocketFactory implements LayeredConnectionSocketFactory, SchemeLayeredSocketFactory,
+                                          LayeredSchemeSocketFactory, LayeredSocketFactory {
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractAuthenticationHandler.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractAuthenticationHandler.java
+index c3af00d..eb7e10b 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractAuthenticationHandler.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractAuthenticationHandler.java
+@@ -40,7 +40,8 @@ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.FormattedHeader;
+ import org.apache.http.Header;
+ import org.apache.http.HttpResponse;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthSchemeRegistry;
+ import org.apache.http.auth.AuthenticationException;
+@@ -61,7 +62,7 @@ import org.apache.http.util.CharArrayBuffer;
+  * @deprecated (4.2)  use {@link org.apache.http.client.AuthenticationStrategy}
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public abstract class AbstractAuthenticationHandler implements AuthenticationHandler {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractHttpClient.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractHttpClient.java
+index 18a42d7..307dd7d 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractHttpClient.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AbstractHttpClient.java
+@@ -39,7 +39,8 @@ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpRequestInterceptor;
+ import org.apache.http.HttpResponseInterceptor;
+ import org.apache.http.annotation.GuardedBy;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthSchemeRegistry;
+ import org.apache.http.client.AuthenticationHandler;
+ import org.apache.http.client.AuthenticationStrategy;
+@@ -194,7 +195,7 @@ import org.apache.http.util.Args;
+  *
+  * @deprecated (4.3) use {@link HttpClientBuilder}.
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public abstract class AbstractHttpClient extends CloseableHttpClient {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AuthenticationStrategyAdaptor.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AuthenticationStrategyAdaptor.java
+index 2ff4ccf..12abacc 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AuthenticationStrategyAdaptor.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AuthenticationStrategyAdaptor.java
+@@ -37,7 +37,8 @@ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.Header;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpResponse;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthOption;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthScope;
+@@ -56,7 +57,7 @@ import org.apache.http.util.Args;
+ /**
+  * @deprecated (4.2) do not use
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ class AuthenticationStrategyAdaptor implements AuthenticationStrategy {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AutoRetryHttpClient.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AutoRetryHttpClient.java
+index 272872a..4dafc07 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AutoRetryHttpClient.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/AutoRetryHttpClient.java
+@@ -36,7 +36,8 @@ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpResponse;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.HttpClient;
+ import org.apache.http.client.ResponseHandler;
+ import org.apache.http.client.ServiceUnavailableRetryStrategy;
+@@ -56,7 +57,7 @@ import org.apache.http.util.EntityUtils;
+  * @deprecated (4.3) use {@link HttpClientBuilder}.
+  */
+ @Deprecated
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class AutoRetryHttpClient implements HttpClient {
+ 
+     private final HttpClient backend;
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/ContentEncodingHttpClient.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/ContentEncodingHttpClient.java
+index 4f1bd33..ebb5037 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/ContentEncodingHttpClient.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/ContentEncodingHttpClient.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.client;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.protocol.RequestAcceptEncoding;
+ import org.apache.http.client.protocol.ResponseContentEncoding;
+ import org.apache.http.conn.ClientConnectionManager;
+@@ -50,7 +51,7 @@ import org.apache.http.protocol.BasicHttpProcessor;
+  * @deprecated (4.2) use {@link HttpClientBuilder}
+  */
+ @Deprecated
+- at ThreadSafe // since DefaultHttpClient is
++ at Contract(threading = ThreadingBehavior.SAFE) // since DefaultHttpClient is
+ public class ContentEncodingHttpClient extends DefaultHttpClient {
+ 
+     /**
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultHttpClient.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultHttpClient.java
+index e64b008..1af8038 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultHttpClient.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultHttpClient.java
+@@ -28,7 +28,8 @@
+ package org.apache.http.impl.client;
+ 
+ import org.apache.http.HttpVersion;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.protocol.RequestAddCookies;
+ import org.apache.http.client.protocol.RequestAuthCache;
+ import org.apache.http.client.protocol.RequestClientConnControl;
+@@ -112,7 +113,7 @@ import org.apache.http.util.VersionInfo;
+  *
+  * @deprecated (4.3) use {@link HttpClientBuilder} see also {@link CloseableHttpClient}.
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public class DefaultHttpClient extends AbstractHttpClient {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultProxyAuthenticationHandler.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultProxyAuthenticationHandler.java
+index 14ce013..256837f 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultProxyAuthenticationHandler.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultProxyAuthenticationHandler.java
+@@ -33,7 +33,8 @@ import java.util.Map;
+ import org.apache.http.Header;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpStatus;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AUTH;
+ import org.apache.http.auth.MalformedChallengeException;
+ import org.apache.http.auth.params.AuthPNames;
+@@ -49,7 +50,7 @@ import org.apache.http.util.Args;
+  * @deprecated (4.2)  use {@link ProxyAuthenticationStrategy}
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultProxyAuthenticationHandler extends AbstractAuthenticationHandler {
+ 
+     public DefaultProxyAuthenticationHandler() {
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultRedirectHandler.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultRedirectHandler.java
+index 228b690..3d8340d 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultRedirectHandler.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultRedirectHandler.java
+@@ -38,7 +38,8 @@ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpStatus;
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.CircularRedirectException;
+ import org.apache.http.client.RedirectHandler;
+ import org.apache.http.client.methods.HttpGet;
+@@ -58,7 +59,7 @@ import org.apache.http.util.Asserts;
+  *
+  * @deprecated (4.1)  use {@link DefaultRedirectStrategy}.
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class DefaultRedirectHandler implements RedirectHandler {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultRedirectStrategyAdaptor.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultRedirectStrategyAdaptor.java
+index d87090f..5b47c24 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultRedirectStrategyAdaptor.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultRedirectStrategyAdaptor.java
+@@ -32,7 +32,8 @@ import java.net.URI;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.RedirectHandler;
+ import org.apache.http.client.RedirectStrategy;
+ import org.apache.http.client.methods.HttpGet;
+@@ -43,7 +44,7 @@ import org.apache.http.protocol.HttpContext;
+ /**
+  * @deprecated (4.1) do not use
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ class DefaultRedirectStrategyAdaptor implements RedirectStrategy {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultTargetAuthenticationHandler.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultTargetAuthenticationHandler.java
+index c47f9e0..aa9dffc 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultTargetAuthenticationHandler.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultTargetAuthenticationHandler.java
+@@ -33,7 +33,8 @@ import java.util.Map;
+ import org.apache.http.Header;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpStatus;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AUTH;
+ import org.apache.http.auth.MalformedChallengeException;
+ import org.apache.http.auth.params.AuthPNames;
+@@ -49,7 +50,7 @@ import org.apache.http.util.Args;
+  * @deprecated (4.2)  use {@link TargetAuthenticationStrategy}
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultTargetAuthenticationHandler extends AbstractAuthenticationHandler {
+ 
+     public DefaultTargetAuthenticationHandler() {
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/RoutedRequest.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/RoutedRequest.java
+index 43a0a80..bde608a 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/RoutedRequest.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/RoutedRequest.java
+@@ -42,7 +42,7 @@ import org.apache.http.conn.routing.HttpRoute;
+ public class RoutedRequest {
+ 
+     protected final RequestWrapper request; // @NotThreadSafe
+-    protected final HttpRoute route; // @Immutable
++    protected final HttpRoute route; // @Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ 
+     /**
+      * Creates a new routed request.
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/SystemDefaultHttpClient.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/SystemDefaultHttpClient.java
+index 0d3c581..b99bec1 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/SystemDefaultHttpClient.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/SystemDefaultHttpClient.java
+@@ -30,7 +30,8 @@ package org.apache.http.impl.client;
+ import java.net.ProxySelector;
+ 
+ import org.apache.http.ConnectionReuseStrategy;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.ClientConnectionManager;
+ import org.apache.http.conn.routing.HttpRoutePlanner;
+ import org.apache.http.impl.DefaultConnectionReuseStrategy;
+@@ -104,7 +105,7 @@ import org.apache.http.params.HttpParams;
+  *
+  * @deprecated (4.3) use {@link HttpClientBuilder}
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public class SystemDefaultHttpClient extends DefaultHttpClient {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/TunnelRefusedException.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/TunnelRefusedException.java
+index 0a6f134..a2fb1d3 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/TunnelRefusedException.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/TunnelRefusedException.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.client;
+ 
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpResponse;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals that the tunnel request was rejected by the proxy host.
+@@ -39,7 +40,7 @@ import org.apache.http.annotation.Immutable;
+  * @deprecated (4.3) reserved for internal use.
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class TunnelRefusedException extends HttpException {
+ 
+     private static final long serialVersionUID = -8646722842745617323L;
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/BasicClientConnectionManager.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/BasicClientConnectionManager.java
+index 9e424a4..fd625d3 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/BasicClientConnectionManager.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/BasicClientConnectionManager.java
+@@ -35,7 +35,8 @@ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.HttpClientConnection;
+ import org.apache.http.annotation.GuardedBy;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.ClientConnectionManager;
+ import org.apache.http.conn.ClientConnectionOperator;
+ import org.apache.http.conn.ClientConnectionRequest;
+@@ -66,7 +67,7 @@ import org.apache.http.util.Asserts;
+  *
+  * @deprecated (4.3) use {@link BasicHttpClientConnectionManager}.
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public class BasicClientConnectionManager implements ClientConnectionManager {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultClientConnectionOperator.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultClientConnectionOperator.java
+index ee14079..0e2692f 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultClientConnectionOperator.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultClientConnectionOperator.java
+@@ -37,7 +37,8 @@ import java.net.UnknownHostException;
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.protocol.ClientContext;
+ import org.apache.http.conn.ClientConnectionOperator;
+ import org.apache.http.conn.ConnectTimeoutException;
+@@ -86,13 +87,13 @@ import org.apache.http.util.Asserts;
+  * @deprecated (4.3) use {@link PoolingHttpClientConnectionManager}.
+  */
+ @Deprecated
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class DefaultClientConnectionOperator implements ClientConnectionOperator {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+ 
+     /** The scheme registry for looking up socket factories. */
+-    protected final SchemeRegistry schemeRegistry; // @ThreadSafe
++    protected final SchemeRegistry schemeRegistry; // @Contract(threading = ThreadingBehavior.SAFE)
+ 
+     /** the custom-configured DNS lookup mechanism. */
+     protected final DnsResolver dnsResolver;
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java
+index 650c202..e735915 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java
+@@ -33,7 +33,8 @@ import java.net.InetAddress;
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.params.ConnRouteParams;
+ import org.apache.http.conn.routing.HttpRoute;
+ import org.apache.http.conn.routing.HttpRoutePlanner;
+@@ -61,12 +62,12 @@ import org.apache.http.util.Asserts;
+  *
+  * @deprecated (4.3) use {@link DefaultRoutePlanner}
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public class DefaultHttpRoutePlanner implements HttpRoutePlanner {
+ 
+     /** The scheme registry. */
+-    protected final SchemeRegistry schemeRegistry; // class is @ThreadSafe
++    protected final SchemeRegistry schemeRegistry; // class is @Contract(threading = ThreadingBehavior.SAFE)
+ 
+     /**
+      * Creates a new default route planner.
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultResponseParser.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultResponseParser.java
+index 456c295..e2ab63d 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultResponseParser.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/DefaultResponseParser.java
+@@ -37,7 +37,8 @@ import org.apache.http.HttpResponseFactory;
+ import org.apache.http.NoHttpResponseException;
+ import org.apache.http.ProtocolException;
+ import org.apache.http.StatusLine;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.impl.io.AbstractMessageParser;
+ import org.apache.http.io.SessionInputBuffer;
+ import org.apache.http.message.LineParser;
+@@ -62,7 +63,7 @@ import org.apache.http.util.CharArrayBuffer;
+  * @deprecated (4.2) use {@link DefaultHttpResponseParser}
+  */
+ @Deprecated
+- at ThreadSafe // no public methods
++ at Contract(threading = ThreadingBehavior.SAFE) // no public methods
+ public class DefaultResponseParser extends AbstractMessageParser<HttpMessage> {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionInputBuffer.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionInputBuffer.java
+index 4708306..2bd8e36 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionInputBuffer.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionInputBuffer.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.conn;
+ import java.io.IOException;
+ 
+ import org.apache.http.Consts;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.io.EofSensor;
+ import org.apache.http.io.HttpTransportMetrics;
+ import org.apache.http.io.SessionInputBuffer;
+@@ -42,7 +43,7 @@ import org.apache.http.util.CharArrayBuffer;
+  *
+  * @deprecated (4.3) no longer used.
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class LoggingSessionInputBuffer implements SessionInputBuffer, EofSensor {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionOutputBuffer.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionOutputBuffer.java
+index a4e9912..90a74f4 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionOutputBuffer.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/LoggingSessionOutputBuffer.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.conn;
+ import java.io.IOException;
+ 
+ import org.apache.http.Consts;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.io.HttpTransportMetrics;
+ import org.apache.http.io.SessionOutputBuffer;
+ import org.apache.http.util.CharArrayBuffer;
+@@ -39,7 +40,7 @@ import org.apache.http.util.CharArrayBuffer;
+  * @since 4.0
+  * @deprecated (4.3) no longer used.
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class LoggingSessionOutputBuffer implements SessionOutputBuffer {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/PoolingClientConnectionManager.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/PoolingClientConnectionManager.java
+index a4e5f28..662b668 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/PoolingClientConnectionManager.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/PoolingClientConnectionManager.java
+@@ -34,7 +34,8 @@ import java.util.concurrent.TimeoutException;
+ 
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.ClientConnectionManager;
+ import org.apache.http.conn.ClientConnectionOperator;
+ import org.apache.http.conn.ClientConnectionRequest;
+@@ -69,7 +70,7 @@ import org.apache.http.util.Asserts;
+  * @deprecated (4.3) use {@link PoolingHttpClientConnectionManager}.
+  */
+ @Deprecated
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class PoolingClientConnectionManager implements ClientConnectionManager, ConnPoolControl<HttpRoute> {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java
+index 2fe96d1..bffbf3e 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java
+@@ -76,7 +76,7 @@ import org.apache.http.util.Asserts;
+ public class ProxySelectorRoutePlanner implements HttpRoutePlanner {
+ 
+     /** The scheme registry. */
+-    protected final SchemeRegistry schemeRegistry; // @ThreadSafe
++    protected final SchemeRegistry schemeRegistry; // @Contract(threading = ThreadingBehavior.SAFE)
+ 
+     /** The proxy selector to use, or {@code null} for system default. */
+     protected ProxySelector proxySelector;
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SchemeRegistryFactory.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SchemeRegistryFactory.java
+index 06105dd..454dbc3 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SchemeRegistryFactory.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SchemeRegistryFactory.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.conn;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.scheme.PlainSocketFactory;
+ import org.apache.http.conn.scheme.Scheme;
+ import org.apache.http.conn.scheme.SchemeRegistry;
+@@ -37,7 +38,7 @@ import org.apache.http.conn.ssl.SSLSocketFactory;
+  *
+  * @deprecated (4.3) use {@link org.apache.http.impl.client.HttpClientBuilder}.
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public final class SchemeRegistryFactory {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SingleClientConnManager.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SingleClientConnManager.java
+index 774cf4a..a8adcb3 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SingleClientConnManager.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/SingleClientConnManager.java
+@@ -33,7 +33,8 @@ import java.util.concurrent.TimeUnit;
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.annotation.GuardedBy;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.ClientConnectionManager;
+ import org.apache.http.conn.ClientConnectionOperator;
+ import org.apache.http.conn.ClientConnectionRequest;
+@@ -61,7 +62,7 @@ import org.apache.http.util.Asserts;
+  *
+  * @deprecated (4.2)  use {@link BasicClientConnectionManager}
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public class SingleClientConnManager implements ClientConnectionManager {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/BasicPoolEntryRef.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/BasicPoolEntryRef.java
+index 2220380..17167ca 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/BasicPoolEntryRef.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/BasicPoolEntryRef.java
+@@ -45,7 +45,7 @@ import org.apache.http.util.Args;
+ public class BasicPoolEntryRef extends WeakReference<BasicPoolEntry> {
+ 
+     /** The planned route of the entry. */
+-    private final HttpRoute route; // HttpRoute is @Immutable
++    private final HttpRoute route; // HttpRoute is @Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ 
+ 
+     /**
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
+index 5bda67c..0a01dd8 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
+@@ -31,7 +31,8 @@ import java.util.concurrent.TimeUnit;
+ 
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.ClientConnectionManager;
+ import org.apache.http.conn.ClientConnectionOperator;
+ import org.apache.http.conn.ClientConnectionRequest;
+@@ -66,14 +67,14 @@ import org.apache.http.util.Asserts;
+  *
+  * @deprecated (4.2)  use {@link org.apache.http.impl.conn.PoolingHttpClientConnectionManager}
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public class ThreadSafeClientConnManager implements ClientConnectionManager {
+ 
+     private final Log log;
+ 
+     /** The schemes supported by this connection manager. */
+-    protected final SchemeRegistry schemeRegistry; // @ThreadSafe
++    protected final SchemeRegistry schemeRegistry; // @Contract(threading = ThreadingBehavior.SAFE)
+ 
+     protected final AbstractConnPool connectionPool;
+ 
+@@ -81,7 +82,7 @@ public class ThreadSafeClientConnManager implements ClientConnectionManager {
+     protected final ConnPoolByRoute pool;
+ 
+     /** The operator for opening and updating connections. */
+-    protected final ClientConnectionOperator connOperator; // DefaultClientConnectionOperator is @ThreadSafe
++    protected final ClientConnectionOperator connOperator; // DefaultClientConnectionOperator is @Contract(threading = ThreadingBehavior.SAFE)
+ 
+     protected final ConnPerRouteBean connPerRoute;
+ 
+@@ -206,7 +207,7 @@ public class ThreadSafeClientConnManager implements ClientConnectionManager {
+     protected ClientConnectionOperator
+         createConnectionOperator(final SchemeRegistry schreg) {
+ 
+-        return new DefaultClientConnectionOperator(schreg);// @ThreadSafe
++        return new DefaultClientConnectionOperator(schreg);// @Contract(threading = ThreadingBehavior.SAFE)
+     }
+ 
+     @Override
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BestMatchSpec.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BestMatchSpec.java
+index a21da60..46afa81 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BestMatchSpec.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BestMatchSpec.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * 'Meta' cookie specification that picks up a cookie policy based on
+@@ -37,7 +38,7 @@ import org.apache.http.annotation.ThreadSafe;
+  *
+  * @since 4.0
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public class BestMatchSpec extends DefaultCookieSpec {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BestMatchSpecFactory.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BestMatchSpecFactory.java
+index 7ad7f63..62aee0a 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BestMatchSpecFactory.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BestMatchSpecFactory.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.cookie;
+ 
+ import java.util.Collection;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.CookieSpec;
+ import org.apache.http.cookie.CookieSpecFactory;
+ import org.apache.http.cookie.CookieSpecProvider;
+@@ -46,7 +47,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class BestMatchSpecFactory implements CookieSpecFactory, CookieSpecProvider {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BrowserCompatSpec.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BrowserCompatSpec.java
+index 46d834d..9ef6b2d 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BrowserCompatSpec.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BrowserCompatSpec.java
+@@ -36,7 +36,8 @@ import org.apache.http.FormattedHeader;
+ import org.apache.http.Header;
+ import org.apache.http.HeaderElement;
+ import org.apache.http.NameValuePair;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.utils.DateUtils;
+ import org.apache.http.cookie.Cookie;
+ import org.apache.http.cookie.CookieAttributeHandler;
+@@ -61,7 +62,7 @@ import org.apache.http.util.CharArrayBuffer;
+  * @since 4.0
+  */
+ @Deprecated
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class BrowserCompatSpec extends CookieSpecBase {
+ 
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java
+index a89908f..584894b 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.cookie;
+ 
+ import java.util.Collection;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.CookieSpec;
+ import org.apache.http.cookie.CookieSpecFactory;
+ import org.apache.http.cookie.CookieSpecProvider;
+@@ -46,7 +47,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class BrowserCompatSpecFactory implements CookieSpecFactory, CookieSpecProvider {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BrowserCompatVersionAttributeHandler.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BrowserCompatVersionAttributeHandler.java
+index 387259c..5effdb4 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BrowserCompatVersionAttributeHandler.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/BrowserCompatVersionAttributeHandler.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.MalformedCookieException;
+@@ -42,7 +43,7 @@ import org.apache.http.util.Args;
+  * @since 4.3
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class BrowserCompatVersionAttributeHandler extends
+         AbstractCookieAttributeHandler implements CommonCookieAttributeHandler {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/DateParseException.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/DateParseException.java
+index e6d07bc..8687d94 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/DateParseException.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/DateParseException.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * An exception to indicate an error parsing a date string.
+@@ -40,7 +41,7 @@ import org.apache.http.annotation.Immutable;
+  * @deprecated (4.3) no longer used.
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DateParseException extends Exception {
+ 
+     private static final long serialVersionUID = 4417696455000643370L;
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/DateUtils.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/DateUtils.java
+index 57e0bd1..554f44d 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/DateUtils.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/DateUtils.java
+@@ -30,7 +30,8 @@ package org.apache.http.impl.cookie;
+ import java.util.Date;
+ import java.util.TimeZone;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * A utility class for parsing and formatting HTTP dates as used in cookies and
+@@ -43,7 +44,7 @@ import org.apache.http.annotation.Immutable;
+  * @deprecated (4.3) Use {@link org.apache.http.client.utils.DateUtils}.
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class DateUtils {
+ 
+     /**
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/IgnoreSpecFactory.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/IgnoreSpecFactory.java
+index 91052c1..e07f8d6 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/IgnoreSpecFactory.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/IgnoreSpecFactory.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.CookieSpec;
+ import org.apache.http.cookie.CookieSpecFactory;
+ import org.apache.http.cookie.CookieSpecProvider;
+@@ -41,7 +42,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class IgnoreSpecFactory implements CookieSpecFactory, CookieSpecProvider {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java
+index e5e72d8..4c55588 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.cookie;
+ 
+ import java.util.Collection;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.CookieSpec;
+ import org.apache.http.cookie.CookieSpecFactory;
+ import org.apache.http.cookie.CookieSpecProvider;
+@@ -46,7 +47,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class NetscapeDraftSpecFactory implements CookieSpecFactory, CookieSpecProvider {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/PublicSuffixListParser.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/PublicSuffixListParser.java
+index 210956c..3d6ef70 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/PublicSuffixListParser.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/PublicSuffixListParser.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.cookie;
+ import java.io.IOException;
+ import java.io.Reader;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.util.PublicSuffixList;
+ 
+ /**
+@@ -40,7 +41,7 @@ import org.apache.http.conn.util.PublicSuffixList;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class PublicSuffixListParser {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/RFC2109SpecFactory.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/RFC2109SpecFactory.java
+index 278e240..1f602eb 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/RFC2109SpecFactory.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/RFC2109SpecFactory.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.cookie;
+ 
+ import java.util.Collection;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.CookieSpec;
+ import org.apache.http.cookie.CookieSpecFactory;
+ import org.apache.http.cookie.CookieSpecProvider;
+@@ -46,7 +47,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class RFC2109SpecFactory implements CookieSpecFactory, CookieSpecProvider {
+ 
+diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/RFC2965SpecFactory.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/RFC2965SpecFactory.java
+index 95ba801..9d9aa60 100644
+--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/RFC2965SpecFactory.java
++++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/cookie/RFC2965SpecFactory.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.cookie;
+ 
+ import java.util.Collection;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.CookieSpec;
+ import org.apache.http.cookie.CookieSpecFactory;
+ import org.apache.http.cookie.CookieSpecProvider;
+@@ -46,7 +47,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class RFC2965SpecFactory implements CookieSpecFactory, CookieSpecProvider {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/auth/AUTH.java b/httpclient/src/main/java/org/apache/http/auth/AUTH.java
+index 8ae4545..fb39ec0 100644
+--- a/httpclient/src/main/java/org/apache/http/auth/AUTH.java
++++ b/httpclient/src/main/java/org/apache/http/auth/AUTH.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.auth;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Constants and static helpers related to the HTTP authentication.
+@@ -35,7 +36,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class AUTH {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthOption.java b/httpclient/src/main/java/org/apache/http/auth/AuthOption.java
+index 21f0bc9..8ea297a 100644
+--- a/httpclient/src/main/java/org/apache/http/auth/AuthOption.java
++++ b/httpclient/src/main/java/org/apache/http/auth/AuthOption.java
+@@ -26,13 +26,14 @@
+  */
+ package org.apache.http.auth;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ 
+ /**
+  * @since 4.2
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class AuthOption {
+ 
+     private final AuthScheme authScheme;
+diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java b/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
+index d3dcddc..c068134 100644
+--- a/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
++++ b/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
+@@ -33,7 +33,8 @@ import java.util.Map;
+ import java.util.concurrent.ConcurrentHashMap;
+ 
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.config.Lookup;
+ import org.apache.http.params.HttpParams;
+ import org.apache.http.protocol.ExecutionContext;
+@@ -48,7 +49,7 @@ import org.apache.http.util.Args;
+  *
+  * @deprecated (4.3) use {@link org.apache.http.config.Registry}
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public final class AuthSchemeRegistry implements Lookup<AuthSchemeProvider> {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthScope.java b/httpclient/src/main/java/org/apache/http/auth/AuthScope.java
+index 5488540..c6f0753 100644
+--- a/httpclient/src/main/java/org/apache/http/auth/AuthScope.java
++++ b/httpclient/src/main/java/org/apache/http/auth/AuthScope.java
+@@ -29,7 +29,8 @@ package org.apache.http.auth;
+ import java.util.Locale;
+ 
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ import org.apache.http.util.LangUtils;
+ 
+@@ -42,7 +43,7 @@ import org.apache.http.util.LangUtils;
+  * </p>
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class AuthScope {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthenticationException.java b/httpclient/src/main/java/org/apache/http/auth/AuthenticationException.java
+index 8d8e34c..59d0fe2 100644
+--- a/httpclient/src/main/java/org/apache/http/auth/AuthenticationException.java
++++ b/httpclient/src/main/java/org/apache/http/auth/AuthenticationException.java
+@@ -27,7 +27,8 @@
+ package org.apache.http.auth;
+ 
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals a failure in authentication process
+@@ -35,7 +36,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class AuthenticationException extends ProtocolException {
+ 
+     private static final long serialVersionUID = -6794031905674764776L;
+diff --git a/httpclient/src/main/java/org/apache/http/auth/BasicUserPrincipal.java b/httpclient/src/main/java/org/apache/http/auth/BasicUserPrincipal.java
+index 92bf4e6..10dd301 100644
+--- a/httpclient/src/main/java/org/apache/http/auth/BasicUserPrincipal.java
++++ b/httpclient/src/main/java/org/apache/http/auth/BasicUserPrincipal.java
+@@ -29,7 +29,8 @@ package org.apache.http.auth;
+ import java.io.Serializable;
+ import java.security.Principal;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ import org.apache.http.util.LangUtils;
+ 
+@@ -38,7 +39,7 @@ import org.apache.http.util.LangUtils;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class BasicUserPrincipal implements Principal, Serializable {
+ 
+     private static final long serialVersionUID = -2266305184969850467L;
+diff --git a/httpclient/src/main/java/org/apache/http/auth/InvalidCredentialsException.java b/httpclient/src/main/java/org/apache/http/auth/InvalidCredentialsException.java
+index e357241..a54528f 100644
+--- a/httpclient/src/main/java/org/apache/http/auth/InvalidCredentialsException.java
++++ b/httpclient/src/main/java/org/apache/http/auth/InvalidCredentialsException.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.auth;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Authentication credentials required to respond to a authentication
+@@ -35,7 +36,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class InvalidCredentialsException extends AuthenticationException {
+ 
+     private static final long serialVersionUID = -4834003835215460648L;
+diff --git a/httpclient/src/main/java/org/apache/http/auth/KerberosCredentials.java b/httpclient/src/main/java/org/apache/http/auth/KerberosCredentials.java
+index 16d0c5b..2a5fe80 100644
+--- a/httpclient/src/main/java/org/apache/http/auth/KerberosCredentials.java
++++ b/httpclient/src/main/java/org/apache/http/auth/KerberosCredentials.java
+@@ -29,7 +29,8 @@ package org.apache.http.auth;
+ import java.io.Serializable;
+ import java.security.Principal;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.ietf.jgss.GSSCredential;
+ 
+ /**
+@@ -37,7 +38,7 @@ import org.ietf.jgss.GSSCredential;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class KerberosCredentials implements Credentials, Serializable {
+ 
+     private static final long serialVersionUID = 487421613855550713L;
+diff --git a/httpclient/src/main/java/org/apache/http/auth/MalformedChallengeException.java b/httpclient/src/main/java/org/apache/http/auth/MalformedChallengeException.java
+index 172ba0c..8b1d924 100644
+--- a/httpclient/src/main/java/org/apache/http/auth/MalformedChallengeException.java
++++ b/httpclient/src/main/java/org/apache/http/auth/MalformedChallengeException.java
+@@ -27,7 +27,8 @@
+ package org.apache.http.auth;
+ 
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals that authentication challenge is in some way invalid or
+@@ -36,7 +37,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class MalformedChallengeException extends ProtocolException {
+ 
+     private static final long serialVersionUID = 814586927989932284L;
+diff --git a/httpclient/src/main/java/org/apache/http/auth/NTCredentials.java b/httpclient/src/main/java/org/apache/http/auth/NTCredentials.java
+index 430eb2d..6ace9fa 100644
+--- a/httpclient/src/main/java/org/apache/http/auth/NTCredentials.java
++++ b/httpclient/src/main/java/org/apache/http/auth/NTCredentials.java
+@@ -30,7 +30,8 @@ import java.io.Serializable;
+ import java.security.Principal;
+ import java.util.Locale;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ import org.apache.http.util.LangUtils;
+ 
+@@ -40,7 +41,7 @@ import org.apache.http.util.LangUtils;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class NTCredentials implements Credentials, Serializable {
+ 
+     private static final long serialVersionUID = -7385699315228907265L;
+diff --git a/httpclient/src/main/java/org/apache/http/auth/NTUserPrincipal.java b/httpclient/src/main/java/org/apache/http/auth/NTUserPrincipal.java
+index 8299939..d89272e 100644
+--- a/httpclient/src/main/java/org/apache/http/auth/NTUserPrincipal.java
++++ b/httpclient/src/main/java/org/apache/http/auth/NTUserPrincipal.java
+@@ -30,7 +30,8 @@ import java.io.Serializable;
+ import java.security.Principal;
+ import java.util.Locale;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ import org.apache.http.util.LangUtils;
+ 
+@@ -39,7 +40,7 @@ import org.apache.http.util.LangUtils;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class NTUserPrincipal implements Principal, Serializable {
+ 
+     private static final long serialVersionUID = -6870169797924406894L;
+diff --git a/httpclient/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java b/httpclient/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java
+index b593b24..4941640 100644
+--- a/httpclient/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java
++++ b/httpclient/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java
+@@ -29,7 +29,8 @@ package org.apache.http.auth;
+ import java.io.Serializable;
+ import java.security.Principal;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ import org.apache.http.util.LangUtils;
+ 
+@@ -39,7 +40,7 @@ import org.apache.http.util.LangUtils;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class UsernamePasswordCredentials implements Credentials, Serializable {
+ 
+     private static final long serialVersionUID = 243343858802739403L;
+diff --git a/httpclient/src/main/java/org/apache/http/client/CircularRedirectException.java b/httpclient/src/main/java/org/apache/http/client/CircularRedirectException.java
+index 489aa72..49b9a0f 100644
+--- a/httpclient/src/main/java/org/apache/http/client/CircularRedirectException.java
++++ b/httpclient/src/main/java/org/apache/http/client/CircularRedirectException.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.client;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals a circular redirect
+@@ -34,7 +35,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class CircularRedirectException extends RedirectException {
+ 
+     private static final long serialVersionUID = 6830063487001091803L;
+diff --git a/httpclient/src/main/java/org/apache/http/client/ClientProtocolException.java b/httpclient/src/main/java/org/apache/http/client/ClientProtocolException.java
+index 8383eac..c4822a5 100644
+--- a/httpclient/src/main/java/org/apache/http/client/ClientProtocolException.java
++++ b/httpclient/src/main/java/org/apache/http/client/ClientProtocolException.java
+@@ -28,14 +28,15 @@ package org.apache.http.client;
+ 
+ import java.io.IOException;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals an error in the HTTP protocol.
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class ClientProtocolException extends IOException {
+ 
+     private static final long serialVersionUID = -5596590843227115865L;
+diff --git a/httpclient/src/main/java/org/apache/http/client/HttpResponseException.java b/httpclient/src/main/java/org/apache/http/client/HttpResponseException.java
+index 07e4377..6929210 100644
+--- a/httpclient/src/main/java/org/apache/http/client/HttpResponseException.java
++++ b/httpclient/src/main/java/org/apache/http/client/HttpResponseException.java
+@@ -26,14 +26,15 @@
+  */
+ package org.apache.http.client;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals a non 2xx HTTP response.
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class HttpResponseException extends ClientProtocolException {
+ 
+     private static final long serialVersionUID = -7186627969477257933L;
+diff --git a/httpclient/src/main/java/org/apache/http/client/NonRepeatableRequestException.java b/httpclient/src/main/java/org/apache/http/client/NonRepeatableRequestException.java
+index 4f4befb..10ae890 100644
+--- a/httpclient/src/main/java/org/apache/http/client/NonRepeatableRequestException.java
++++ b/httpclient/src/main/java/org/apache/http/client/NonRepeatableRequestException.java
+@@ -27,7 +27,8 @@
+ package org.apache.http.client;
+ 
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals failure to retry the request due to non-repeatable request
+@@ -36,7 +37,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class NonRepeatableRequestException extends ProtocolException {
+ 
+     private static final long serialVersionUID = 82685265288806048L;
+diff --git a/httpclient/src/main/java/org/apache/http/client/RedirectException.java b/httpclient/src/main/java/org/apache/http/client/RedirectException.java
+index cf2abac..0c5b9b4 100644
+--- a/httpclient/src/main/java/org/apache/http/client/RedirectException.java
++++ b/httpclient/src/main/java/org/apache/http/client/RedirectException.java
+@@ -27,7 +27,8 @@
+ package org.apache.http.client;
+ 
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals violation of HTTP specification caused by an invalid redirect
+@@ -35,7 +36,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RedirectException extends ProtocolException {
+ 
+     private static final long serialVersionUID = 4418824536372559326L;
+diff --git a/httpclient/src/main/java/org/apache/http/client/config/AuthSchemes.java b/httpclient/src/main/java/org/apache/http/client/config/AuthSchemes.java
+index 58f5d61..1bcace1 100644
+--- a/httpclient/src/main/java/org/apache/http/client/config/AuthSchemes.java
++++ b/httpclient/src/main/java/org/apache/http/client/config/AuthSchemes.java
+@@ -27,14 +27,15 @@
+ 
+ package org.apache.http.client.config;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Standard authentication schemes supported by HttpClient.
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class AuthSchemes {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/client/config/CookieSpecs.java b/httpclient/src/main/java/org/apache/http/client/config/CookieSpecs.java
+index 86477f2..01d020b 100644
+--- a/httpclient/src/main/java/org/apache/http/client/config/CookieSpecs.java
++++ b/httpclient/src/main/java/org/apache/http/client/config/CookieSpecs.java
+@@ -27,14 +27,15 @@
+ 
+ package org.apache.http.client.config;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Standard cookie specifications supported by HttpClient.
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class CookieSpecs {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java b/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java
+index 87f772f..637cfad 100644
+--- a/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java
++++ b/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java
+@@ -31,14 +31,15 @@ import java.net.InetAddress;
+ import java.util.Collection;
+ 
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  *  Immutable class encapsulating request configuration items.
+  *  The default setting for stale connection checking changed
+  *  to false, and the feature was deprecated starting with version 4.4.
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RequestConfig implements Cloneable {
+ 
+     public static final RequestConfig DEFAULT = new Builder().build();
+diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/RequestAcceptEncoding.java b/httpclient/src/main/java/org/apache/http/client/protocol/RequestAcceptEncoding.java
+index 9b260e2..69cc7ec 100644
+--- a/httpclient/src/main/java/org/apache/http/client/protocol/RequestAcceptEncoding.java
++++ b/httpclient/src/main/java/org/apache/http/client/protocol/RequestAcceptEncoding.java
+@@ -32,7 +32,8 @@ import java.util.List;
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpRequestInterceptor;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.config.RequestConfig;
+ import org.apache.http.protocol.HttpContext;
+ 
+@@ -45,7 +46,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RequestAcceptEncoding implements HttpRequestInterceptor {
+ 
+     private final String acceptEncoding;
+diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java b/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
+index b548d04..8855581 100644
+--- a/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
++++ b/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
+@@ -41,7 +41,8 @@ import org.apache.http.HttpException;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpRequestInterceptor;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.CookieStore;
+ import org.apache.http.client.config.CookieSpecs;
+ import org.apache.http.client.config.RequestConfig;
+@@ -63,7 +64,7 @@ import org.apache.http.util.TextUtils;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RequestAddCookies implements HttpRequestInterceptor {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java b/httpclient/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java
+index fa6a362..0d47797 100644
+--- a/httpclient/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java
++++ b/httpclient/src/main/java/org/apache/http/client/protocol/RequestAuthCache.java
+@@ -35,7 +35,8 @@ import org.apache.http.HttpException;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpRequestInterceptor;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthProtocolState;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthScope;
+@@ -54,7 +55,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RequestAuthCache implements HttpRequestInterceptor {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java b/httpclient/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java
+index aba6602..0c2c088 100644
+--- a/httpclient/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java
++++ b/httpclient/src/main/java/org/apache/http/client/protocol/RequestClientConnControl.java
+@@ -34,7 +34,8 @@ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpRequestInterceptor;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.routing.RouteInfo;
+ import org.apache.http.protocol.HTTP;
+ import org.apache.http.protocol.HttpContext;
+@@ -47,7 +48,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RequestClientConnControl implements HttpRequestInterceptor {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java b/httpclient/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java
+index 967270a..f9cdc52 100644
+--- a/httpclient/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java
++++ b/httpclient/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java
+@@ -34,7 +34,8 @@ import org.apache.http.Header;
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpRequestInterceptor;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.params.ClientPNames;
+ import org.apache.http.protocol.HttpContext;
+ import org.apache.http.util.Args;
+@@ -45,7 +46,7 @@ import org.apache.http.util.Args;
+  * @since 4.0
+  */
+ @SuppressWarnings("deprecation")
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RequestDefaultHeaders implements HttpRequestInterceptor {
+ 
+     private final Collection<? extends Header> defaultHeaders;
+diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/RequestExpectContinue.java b/httpclient/src/main/java/org/apache/http/client/protocol/RequestExpectContinue.java
+index 27edc17..887219b 100644
+--- a/httpclient/src/main/java/org/apache/http/client/protocol/RequestExpectContinue.java
++++ b/httpclient/src/main/java/org/apache/http/client/protocol/RequestExpectContinue.java
+@@ -36,7 +36,8 @@ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpRequestInterceptor;
+ import org.apache.http.HttpVersion;
+ import org.apache.http.ProtocolVersion;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.config.RequestConfig;
+ import org.apache.http.protocol.HTTP;
+ import org.apache.http.protocol.HttpContext;
+@@ -52,7 +53,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RequestExpectContinue implements HttpRequestInterceptor {
+ 
+     public RequestExpectContinue() {
+diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java b/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java
+index c4d0cfc..c135fb9 100644
+--- a/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java
++++ b/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java
+@@ -37,7 +37,8 @@ import org.apache.http.HttpEntity;
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpResponseInterceptor;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.config.RequestConfig;
+ import org.apache.http.client.entity.DecompressingEntity;
+ import org.apache.http.client.entity.DeflateInputStream;
+@@ -55,7 +56,7 @@ import org.apache.http.protocol.HttpContext;
+  * @since 4.1
+  *
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class ResponseContentEncoding implements HttpResponseInterceptor {
+ 
+     public static final String UNCOMPRESSED = "http.client.response.uncompressed";
+diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/ResponseProcessCookies.java b/httpclient/src/main/java/org/apache/http/client/protocol/ResponseProcessCookies.java
+index 5f3cfab..a9d9ab1 100644
+--- a/httpclient/src/main/java/org/apache/http/client/protocol/ResponseProcessCookies.java
++++ b/httpclient/src/main/java/org/apache/http/client/protocol/ResponseProcessCookies.java
+@@ -37,7 +37,8 @@ import org.apache.http.HeaderIterator;
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpResponseInterceptor;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.CookieStore;
+ import org.apache.http.cookie.Cookie;
+ import org.apache.http.cookie.CookieOrigin;
+@@ -53,7 +54,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class ResponseProcessCookies implements HttpResponseInterceptor {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/client/utils/CloneUtils.java b/httpclient/src/main/java/org/apache/http/client/utils/CloneUtils.java
+index 597dc26..95728cd 100644
+--- a/httpclient/src/main/java/org/apache/http/client/utils/CloneUtils.java
++++ b/httpclient/src/main/java/org/apache/http/client/utils/CloneUtils.java
+@@ -29,14 +29,15 @@ package org.apache.http.client.utils;
+ import java.lang.reflect.InvocationTargetException;
+ import java.lang.reflect.Method;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * A collection of utilities to workaround limitations of Java clone framework.
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class CloneUtils {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/client/utils/DateUtils.java b/httpclient/src/main/java/org/apache/http/client/utils/DateUtils.java
+index a18fbd7..0abb464 100644
+--- a/httpclient/src/main/java/org/apache/http/client/utils/DateUtils.java
++++ b/httpclient/src/main/java/org/apache/http/client/utils/DateUtils.java
+@@ -37,7 +37,8 @@ import java.util.Locale;
+ import java.util.Map;
+ import java.util.TimeZone;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ 
+ /**
+@@ -47,7 +48,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class DateUtils {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java b/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
+index 72c299e..e6b0f58 100644
+--- a/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
++++ b/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
+@@ -33,7 +33,8 @@ import java.util.Locale;
+ import java.util.Stack;
+ 
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.routing.RouteInfo;
+ import org.apache.http.util.Args;
+ import org.apache.http.util.TextUtils;
+@@ -44,7 +45,7 @@ import org.apache.http.util.TextUtils;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class URIUtils {
+ 
+      /**
+diff --git a/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java b/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java
+index de18e6d..1f50716 100644
+--- a/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java
++++ b/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java
+@@ -46,7 +46,8 @@ import org.apache.http.Header;
+ import org.apache.http.HeaderElement;
+ import org.apache.http.HttpEntity;
+ import org.apache.http.NameValuePair;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.entity.ContentType;
+ import org.apache.http.message.BasicNameValuePair;
+ import org.apache.http.message.ParserCursor;
+@@ -60,7 +61,7 @@ import org.apache.http.util.CharArrayBuffer;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class URLEncodedUtils {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/conn/ConnectTimeoutException.java b/httpclient/src/main/java/org/apache/http/conn/ConnectTimeoutException.java
+index a76bcda..8186812 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/ConnectTimeoutException.java
++++ b/httpclient/src/main/java/org/apache/http/conn/ConnectTimeoutException.java
+@@ -33,7 +33,8 @@ import java.net.InetAddress;
+ import java.util.Arrays;
+ 
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * A timeout while connecting to an HTTP server or waiting for an
+@@ -42,7 +43,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class ConnectTimeoutException extends InterruptedIOException {
+ 
+     private static final long serialVersionUID = -4816682903149535989L;
+diff --git a/httpclient/src/main/java/org/apache/http/conn/ConnectionPoolTimeoutException.java b/httpclient/src/main/java/org/apache/http/conn/ConnectionPoolTimeoutException.java
+index 3328cc4..0b6f319 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/ConnectionPoolTimeoutException.java
++++ b/httpclient/src/main/java/org/apache/http/conn/ConnectionPoolTimeoutException.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.conn;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * A timeout while waiting for an available connection
+@@ -36,7 +37,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class ConnectionPoolTimeoutException extends ConnectTimeoutException {
+ 
+     private static final long serialVersionUID = -7898874842020245128L;
+diff --git a/httpclient/src/main/java/org/apache/http/conn/HttpHostConnectException.java b/httpclient/src/main/java/org/apache/http/conn/HttpHostConnectException.java
+index fa88a45..a62fab0 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/HttpHostConnectException.java
++++ b/httpclient/src/main/java/org/apache/http/conn/HttpHostConnectException.java
+@@ -32,7 +32,8 @@ import java.net.InetAddress;
+ import java.util.Arrays;
+ 
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * A {@link ConnectException} that specifies the {@link HttpHost} that was
+@@ -40,7 +41,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class HttpHostConnectException extends ConnectException {
+ 
+     private static final long serialVersionUID = -3194482710275220224L;
+diff --git a/httpclient/src/main/java/org/apache/http/conn/UnsupportedSchemeException.java b/httpclient/src/main/java/org/apache/http/conn/UnsupportedSchemeException.java
+index 268a0b8..644820b 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/UnsupportedSchemeException.java
++++ b/httpclient/src/main/java/org/apache/http/conn/UnsupportedSchemeException.java
+@@ -29,14 +29,15 @@ package org.apache.http.conn;
+ 
+ import java.io.IOException;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals failure to establish connection using an unknown protocol scheme.
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class UnsupportedSchemeException extends IOException {
+ 
+     private static final long serialVersionUID = 3597127619218687636L;
+diff --git a/httpclient/src/main/java/org/apache/http/conn/routing/BasicRouteDirector.java b/httpclient/src/main/java/org/apache/http/conn/routing/BasicRouteDirector.java
+index eff3f04..d08ec89 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/routing/BasicRouteDirector.java
++++ b/httpclient/src/main/java/org/apache/http/conn/routing/BasicRouteDirector.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.conn.routing;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ 
+ /**
+@@ -35,7 +36,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class BasicRouteDirector implements HttpRouteDirector {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java b/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
+index 847fa7e..146e5ff 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
++++ b/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
+@@ -35,7 +35,8 @@ import java.util.Collections;
+ import java.util.List;
+ 
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ import org.apache.http.util.LangUtils;
+ 
+@@ -44,7 +45,7 @@ import org.apache.http.util.LangUtils;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class HttpRoute implements RouteInfo, Cloneable {
+ 
+     /** The target host to connect to. */
+diff --git a/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java b/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java
+index 68d7aa9..68c260c 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java
++++ b/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java
+@@ -28,7 +28,8 @@ package org.apache.http.conn.scheme;
+ 
+ import java.util.Locale;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ import org.apache.http.util.LangUtils;
+ 
+@@ -50,7 +51,7 @@ import org.apache.http.util.LangUtils;
+  * @deprecated (4.3) use {@link org.apache.http.conn.SchemePortResolver} for default port
+  * resolution and {@link org.apache.http.config.Registry} for socket factory lookups.
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public final class Scheme {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeRegistry.java b/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeRegistry.java
+index 6928ce5..64820d7 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeRegistry.java
++++ b/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeRegistry.java
+@@ -32,7 +32,8 @@ import java.util.Map;
+ import java.util.concurrent.ConcurrentHashMap;
+ 
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ 
+ /**
+@@ -43,7 +44,7 @@ import org.apache.http.util.Args;
+  *
+  * @deprecated (4.3) use {@link org.apache.http.config.Registry}
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public final class SchemeRegistry {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/conn/socket/PlainConnectionSocketFactory.java b/httpclient/src/main/java/org/apache/http/conn/socket/PlainConnectionSocketFactory.java
+index 193e73d..e81f6ca 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/socket/PlainConnectionSocketFactory.java
++++ b/httpclient/src/main/java/org/apache/http/conn/socket/PlainConnectionSocketFactory.java
+@@ -32,7 +32,8 @@ import java.net.InetSocketAddress;
+ import java.net.Socket;
+ 
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.protocol.HttpContext;
+ 
+ /**
+@@ -40,7 +41,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class PlainConnectionSocketFactory implements ConnectionSocketFactory {
+ 
+     public static final PlainConnectionSocketFactory INSTANCE = new PlainConnectionSocketFactory();
+diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/AllowAllHostnameVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/AllowAllHostnameVerifier.java
+index 3dc856e..d5de7fb 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/ssl/AllowAllHostnameVerifier.java
++++ b/httpclient/src/main/java/org/apache/http/conn/ssl/AllowAllHostnameVerifier.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.conn.ssl;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * The ALLOW_ALL HostnameVerifier essentially turns hostname verification
+@@ -39,7 +40,7 @@ import org.apache.http.annotation.Immutable;
+  * @deprecated (4.4) Use {@link org.apache.http.conn.ssl.NoopHostnameVerifier}
+  */
+ @Deprecated
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class AllowAllHostnameVerifier extends AbstractVerifier {
+ 
+     public static final AllowAllHostnameVerifier INSTANCE = new AllowAllHostnameVerifier();
+diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java
+index 4c4aee9..eb311d3 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java
++++ b/httpclient/src/main/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java
+@@ -29,7 +29,8 @@ package org.apache.http.conn.ssl;
+ 
+ import javax.net.ssl.SSLException;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * The HostnameVerifier that works the same way as Curl and Firefox.
+@@ -47,7 +48,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @deprecated (4.4) Use {@link org.apache.http.conn.ssl.DefaultHostnameVerifier}
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class BrowserCompatHostnameVerifier extends AbstractVerifier {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java
+index 8539791..960f7f2 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java
++++ b/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java
+@@ -51,7 +51,8 @@ import javax.security.auth.x500.X500Principal;
+ 
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.util.DomainType;
+ import org.apache.http.conn.util.InetAddressUtils;
+ import org.apache.http.conn.util.PublicSuffixMatcher;
+@@ -61,7 +62,7 @@ import org.apache.http.conn.util.PublicSuffixMatcher;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class DefaultHostnameVerifier implements HostnameVerifier {
+ 
+     enum TYPE { IPv4, IPv6, DNS };
+diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/NoopHostnameVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/NoopHostnameVerifier.java
+index 1b5cdd9..1d41df1 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/ssl/NoopHostnameVerifier.java
++++ b/httpclient/src/main/java/org/apache/http/conn/ssl/NoopHostnameVerifier.java
+@@ -30,7 +30,8 @@ package org.apache.http.conn.ssl;
+ import javax.net.ssl.HostnameVerifier;
+ import javax.net.ssl.SSLSession;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * The NO_OP HostnameVerifier essentially turns hostname verification
+@@ -38,7 +39,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class NoopHostnameVerifier implements HostnameVerifier {
+ 
+     public static final NoopHostnameVerifier INSTANCE = new NoopHostnameVerifier();
+diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java b/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java
+index df8689b..3ab0fce 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java
++++ b/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java
+@@ -50,7 +50,8 @@ import javax.security.auth.x500.X500Principal;
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
+ import org.apache.http.conn.util.PublicSuffixMatcherLoader;
+ import org.apache.http.protocol.HttpContext;
+@@ -133,7 +134,7 @@ import org.apache.http.util.TextUtils;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe @SuppressWarnings("deprecation")
++ at Contract(threading = ThreadingBehavior.SAFE) @SuppressWarnings("deprecation")
+ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactory {
+ 
+     public static final String TLS   = "TLS";
+diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java
+index 362d6ab..2e55c37 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java
++++ b/httpclient/src/main/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java
+@@ -29,7 +29,8 @@ package org.apache.http.conn.ssl;
+ 
+ import javax.net.ssl.SSLException;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * The Strict HostnameVerifier works the same way as Sun Java 1.4, Sun
+@@ -53,7 +54,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @deprecated (4.4) Use {@link org.apache.http.conn.ssl.DefaultHostnameVerifier}
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @Deprecated
+ public class StrictHostnameVerifier extends AbstractVerifier {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/conn/util/InetAddressUtils.java b/httpclient/src/main/java/org/apache/http/conn/util/InetAddressUtils.java
+index acee8af..f47bee6 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/util/InetAddressUtils.java
++++ b/httpclient/src/main/java/org/apache/http/conn/util/InetAddressUtils.java
+@@ -29,14 +29,15 @@ package org.apache.http.conn.util;
+ 
+ import java.util.regex.Pattern;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * A collection of utilities relating to InetAddresses.
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class InetAddressUtils {
+ 
+     private InetAddressUtils() {
+diff --git a/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixList.java b/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixList.java
+index dfdd928..1202a07 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixList.java
++++ b/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixList.java
+@@ -29,7 +29,8 @@ package org.apache.http.conn.util;
+ import java.util.Collections;
+ import java.util.List;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ 
+ /**
+@@ -41,7 +42,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class PublicSuffixList {
+ 
+     private final DomainType type;
+diff --git a/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixListParser.java b/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixListParser.java
+index 0bf63e1..ad2cfa8 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixListParser.java
++++ b/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixListParser.java
+@@ -32,7 +32,8 @@ import java.io.Reader;
+ import java.util.ArrayList;
+ import java.util.List;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Parses the list from <a href="http://publicsuffix.org/">publicsuffix.org</a>
+@@ -40,7 +41,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class PublicSuffixListParser {
+ 
+     public PublicSuffixListParser() {
+diff --git a/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixMatcher.java b/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixMatcher.java
+index 2ec340f..441556a 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixMatcher.java
++++ b/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixMatcher.java
+@@ -33,7 +33,8 @@ import java.util.Locale;
+ import java.util.Map;
+ import java.util.concurrent.ConcurrentHashMap;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ 
+ /**
+@@ -46,7 +47,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.4
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public final class PublicSuffixMatcher {
+ 
+     private final Map<String, DomainType> rules;
+diff --git a/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixMatcherLoader.java b/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixMatcherLoader.java
+index 5a25b46..2745f9e 100644
+--- a/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixMatcherLoader.java
++++ b/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixMatcherLoader.java
+@@ -38,7 +38,8 @@ import java.util.List;
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.Consts;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ 
+ /**
+@@ -46,7 +47,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.4
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public final class PublicSuffixMatcherLoader {
+ 
+     private static PublicSuffixMatcher load(final InputStream in) throws IOException {
+diff --git a/httpclient/src/main/java/org/apache/http/cookie/CookieIdentityComparator.java b/httpclient/src/main/java/org/apache/http/cookie/CookieIdentityComparator.java
+index 935a5a3..5b6431d 100644
+--- a/httpclient/src/main/java/org/apache/http/cookie/CookieIdentityComparator.java
++++ b/httpclient/src/main/java/org/apache/http/cookie/CookieIdentityComparator.java
+@@ -30,7 +30,8 @@ package org.apache.http.cookie;
+ import java.io.Serializable;
+ import java.util.Comparator;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * This cookie comparator can be used to compare identity of cookies.
+@@ -40,7 +41,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class CookieIdentityComparator implements Serializable, Comparator<Cookie> {
+ 
+     private static final long serialVersionUID = 4466565437490631532L;
+diff --git a/httpclient/src/main/java/org/apache/http/cookie/CookieOrigin.java b/httpclient/src/main/java/org/apache/http/cookie/CookieOrigin.java
+index b46f6bd..34f8f7c 100644
+--- a/httpclient/src/main/java/org/apache/http/cookie/CookieOrigin.java
++++ b/httpclient/src/main/java/org/apache/http/cookie/CookieOrigin.java
+@@ -28,7 +28,8 @@ package org.apache.http.cookie;
+ 
+ import java.util.Locale;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ import org.apache.http.util.TextUtils;
+ 
+@@ -38,7 +39,7 @@ import org.apache.http.util.TextUtils;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public final class CookieOrigin {
+ 
+     private final String host;
+diff --git a/httpclient/src/main/java/org/apache/http/cookie/CookiePathComparator.java b/httpclient/src/main/java/org/apache/http/cookie/CookiePathComparator.java
+index f9e3e76..df33634 100644
+--- a/httpclient/src/main/java/org/apache/http/cookie/CookiePathComparator.java
++++ b/httpclient/src/main/java/org/apache/http/cookie/CookiePathComparator.java
+@@ -30,7 +30,8 @@ package org.apache.http.cookie;
+ import java.io.Serializable;
+ import java.util.Comparator;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * This cookie comparator ensures that multiple cookies satisfying
+@@ -47,7 +48,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class CookiePathComparator implements Serializable, Comparator<Cookie> {
+ 
+     public static final CookiePathComparator INSTANCE = new CookiePathComparator();
+diff --git a/httpclient/src/main/java/org/apache/http/cookie/CookiePriorityComparator.java b/httpclient/src/main/java/org/apache/http/cookie/CookiePriorityComparator.java
+index 77e4e01..332cdae 100644
+--- a/httpclient/src/main/java/org/apache/http/cookie/CookiePriorityComparator.java
++++ b/httpclient/src/main/java/org/apache/http/cookie/CookiePriorityComparator.java
+@@ -30,7 +30,8 @@ package org.apache.http.cookie;
+ import java.util.Comparator;
+ import java.util.Date;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.impl.cookie.BasicClientCookie;
+ 
+ /**
+@@ -40,7 +41,7 @@ import org.apache.http.impl.cookie.BasicClientCookie;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class CookiePriorityComparator implements Comparator<Cookie> {
+ 
+     public static final CookiePriorityComparator INSTANCE = new CookiePriorityComparator();
+diff --git a/httpclient/src/main/java/org/apache/http/cookie/CookieRestrictionViolationException.java b/httpclient/src/main/java/org/apache/http/cookie/CookieRestrictionViolationException.java
+index 3b30a97..f712f93 100644
+--- a/httpclient/src/main/java/org/apache/http/cookie/CookieRestrictionViolationException.java
++++ b/httpclient/src/main/java/org/apache/http/cookie/CookieRestrictionViolationException.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals that a cookie violates a restriction imposed by the cookie
+@@ -35,7 +36,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class CookieRestrictionViolationException extends MalformedCookieException {
+ 
+     private static final long serialVersionUID = 7371235577078589013L;
+diff --git a/httpclient/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java b/httpclient/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java
+index 43e6ffe..9cfffac 100644
+--- a/httpclient/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java
++++ b/httpclient/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java
+@@ -34,7 +34,8 @@ import java.util.Map;
+ import java.util.concurrent.ConcurrentHashMap;
+ 
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.config.Lookup;
+ import org.apache.http.params.HttpParams;
+ import org.apache.http.protocol.ExecutionContext;
+@@ -50,7 +51,7 @@ import org.apache.http.util.Args;
+  *
+  * @deprecated (4.3) use {@link org.apache.http.config.Registry}.
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @Deprecated
+ public final class CookieSpecRegistry implements Lookup<CookieSpecProvider> {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/cookie/MalformedCookieException.java b/httpclient/src/main/java/org/apache/http/cookie/MalformedCookieException.java
+index da70979..6c5076b 100644
+--- a/httpclient/src/main/java/org/apache/http/cookie/MalformedCookieException.java
++++ b/httpclient/src/main/java/org/apache/http/cookie/MalformedCookieException.java
+@@ -28,7 +28,8 @@
+ package org.apache.http.cookie;
+ 
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals that a cookie is in some way invalid or illegal in a given
+@@ -37,7 +38,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class MalformedCookieException extends ProtocolException {
+ 
+     private static final long serialVersionUID = -6695462944287282185L;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/BasicSchemeFactory.java b/httpclient/src/main/java/org/apache/http/impl/auth/BasicSchemeFactory.java
+index 5409a77..5cc1794 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/auth/BasicSchemeFactory.java
++++ b/httpclient/src/main/java/org/apache/http/impl/auth/BasicSchemeFactory.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.auth;
+ 
+ import java.nio.charset.Charset;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthSchemeFactory;
+ import org.apache.http.auth.AuthSchemeProvider;
+@@ -42,7 +43,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @SuppressWarnings("deprecation")
+ public class BasicSchemeFactory implements AuthSchemeFactory, AuthSchemeProvider {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/DigestSchemeFactory.java b/httpclient/src/main/java/org/apache/http/impl/auth/DigestSchemeFactory.java
+index 67a4e9e..ce4340f 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/auth/DigestSchemeFactory.java
++++ b/httpclient/src/main/java/org/apache/http/impl/auth/DigestSchemeFactory.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.auth;
+ 
+ import java.nio.charset.Charset;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthSchemeFactory;
+ import org.apache.http.auth.AuthSchemeProvider;
+@@ -42,7 +43,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @SuppressWarnings("deprecation")
+ public class DigestSchemeFactory implements AuthSchemeFactory, AuthSchemeProvider {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/KerberosSchemeFactory.java b/httpclient/src/main/java/org/apache/http/impl/auth/KerberosSchemeFactory.java
+index 431258e..68b6c15 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/auth/KerberosSchemeFactory.java
++++ b/httpclient/src/main/java/org/apache/http/impl/auth/KerberosSchemeFactory.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.auth;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthSchemeFactory;
+ import org.apache.http.auth.AuthSchemeProvider;
+@@ -39,7 +40,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.2
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @SuppressWarnings("deprecation")
+ public class KerberosSchemeFactory implements AuthSchemeFactory, AuthSchemeProvider {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineException.java b/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineException.java
+index f902ae1..59d1758 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineException.java
++++ b/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineException.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.auth;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthenticationException;
+ 
+ /**
+@@ -35,7 +36,7 @@ import org.apache.http.auth.AuthenticationException;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class NTLMEngineException extends AuthenticationException {
+ 
+     private static final long serialVersionUID = 6027981323731768824L;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/NTLMSchemeFactory.java b/httpclient/src/main/java/org/apache/http/impl/auth/NTLMSchemeFactory.java
+index 8e38c82..6f28754 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/auth/NTLMSchemeFactory.java
++++ b/httpclient/src/main/java/org/apache/http/impl/auth/NTLMSchemeFactory.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.auth;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthSchemeFactory;
+ import org.apache.http.auth.AuthSchemeProvider;
+@@ -41,7 +42,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @SuppressWarnings("deprecation")
+ public class NTLMSchemeFactory implements AuthSchemeFactory, AuthSchemeProvider {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/SPNegoSchemeFactory.java b/httpclient/src/main/java/org/apache/http/impl/auth/SPNegoSchemeFactory.java
+index 42e506d..75dd845 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/auth/SPNegoSchemeFactory.java
++++ b/httpclient/src/main/java/org/apache/http/impl/auth/SPNegoSchemeFactory.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.auth;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthSchemeFactory;
+ import org.apache.http.auth.AuthSchemeProvider;
+@@ -39,7 +40,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.2
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @SuppressWarnings("deprecation")
+ public class SPNegoSchemeFactory implements AuthSchemeFactory, AuthSchemeProvider {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/UnsupportedDigestAlgorithmException.java b/httpclient/src/main/java/org/apache/http/impl/auth/UnsupportedDigestAlgorithmException.java
+index 2d6b6ec..2a64871 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/auth/UnsupportedDigestAlgorithmException.java
++++ b/httpclient/src/main/java/org/apache/http/impl/auth/UnsupportedDigestAlgorithmException.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.auth;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Authentication credentials required to respond to a authentication
+@@ -35,7 +36,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class UnsupportedDigestAlgorithmException extends RuntimeException {
+ 
+     private static final long serialVersionUID = 319558534317118022L;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/AbstractResponseHandler.java b/httpclient/src/main/java/org/apache/http/impl/client/AbstractResponseHandler.java
+index 290a88c..55e50ce 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/AbstractResponseHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/AbstractResponseHandler.java
+@@ -32,7 +32,8 @@ import java.io.IOException;
+ import org.apache.http.HttpEntity;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.StatusLine;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.HttpResponseException;
+ import org.apache.http.client.ResponseHandler;
+ import org.apache.http.util.EntityUtils;
+@@ -50,7 +51,7 @@ import org.apache.http.util.EntityUtils;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public abstract class AbstractResponseHandler<T> implements ResponseHandler<T> {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java b/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java
+index cd15aea..a2e7913 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java
+@@ -43,7 +43,8 @@ import org.apache.http.FormattedHeader;
+ import org.apache.http.Header;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpResponse;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthOption;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthSchemeProvider;
+@@ -62,7 +63,7 @@ import org.apache.http.protocol.HttpContext;
+ import org.apache.http.util.Args;
+ import org.apache.http.util.CharArrayBuffer;
+ 
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ abstract class AuthenticationStrategyImpl implements AuthenticationStrategy {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java b/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java
+index 97dabb3..0b018b1 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java
+@@ -38,7 +38,8 @@ import java.util.concurrent.ConcurrentHashMap;
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.client.AuthCache;
+ import org.apache.http.conn.SchemePortResolver;
+@@ -56,7 +57,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.1
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class BasicAuthCache implements AuthCache {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/BasicCookieStore.java b/httpclient/src/main/java/org/apache/http/impl/client/BasicCookieStore.java
+index 52b76b1..8430a6e 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/BasicCookieStore.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/BasicCookieStore.java
+@@ -34,7 +34,8 @@ import java.util.List;
+ import java.util.TreeSet;
+ 
+ import org.apache.http.annotation.GuardedBy;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.CookieStore;
+ import org.apache.http.cookie.Cookie;
+ import org.apache.http.cookie.CookieIdentityComparator;
+@@ -45,7 +46,7 @@ import org.apache.http.cookie.CookieIdentityComparator;
+  *
+  * @since 4.0
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class BasicCookieStore implements CookieStore, Serializable {
+ 
+     private static final long serialVersionUID = -7581093305228232025L;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java b/httpclient/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java
+index 352bbfd..c2f7021 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.client;
+ import java.util.Map;
+ import java.util.concurrent.ConcurrentHashMap;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScope;
+ import org.apache.http.auth.Credentials;
+ import org.apache.http.client.CredentialsProvider;
+@@ -40,7 +41,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class BasicCredentialsProvider implements CredentialsProvider {
+ 
+     private final ConcurrentHashMap<AuthScope, Credentials> credMap;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java b/httpclient/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java
+index 76766ea..4b3afaf 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java
+@@ -31,7 +31,8 @@ import java.io.IOException;
+ 
+ import org.apache.http.HttpEntity;
+ import org.apache.http.HttpResponse;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.HttpResponseException;
+ import org.apache.http.util.EntityUtils;
+ 
+@@ -48,7 +49,7 @@ import org.apache.http.util.EntityUtils;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class BasicResponseHandler extends AbstractResponseHandler<String> {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/CloseableHttpClient.java b/httpclient/src/main/java/org/apache/http/impl/client/CloseableHttpClient.java
+index 16dfae2..1e1709d 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/CloseableHttpClient.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/CloseableHttpClient.java
+@@ -36,7 +36,8 @@ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.HttpEntity;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.ClientProtocolException;
+ import org.apache.http.client.HttpClient;
+ import org.apache.http.client.ResponseHandler;
+@@ -52,7 +53,7 @@ import org.apache.http.util.EntityUtils;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public abstract class CloseableHttpClient implements HttpClient, Closeable {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/DefaultConnectionKeepAliveStrategy.java b/httpclient/src/main/java/org/apache/http/impl/client/DefaultConnectionKeepAliveStrategy.java
+index 6e757d1..15402d5 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/DefaultConnectionKeepAliveStrategy.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/DefaultConnectionKeepAliveStrategy.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.client;
+ import org.apache.http.HeaderElement;
+ import org.apache.http.HeaderElementIterator;
+ import org.apache.http.HttpResponse;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.ConnectionKeepAliveStrategy;
+ import org.apache.http.message.BasicHeaderElementIterator;
+ import org.apache.http.protocol.HTTP;
+@@ -45,7 +46,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultConnectionKeepAliveStrategy implements ConnectionKeepAliveStrategy {
+ 
+     public static final DefaultConnectionKeepAliveStrategy INSTANCE = new DefaultConnectionKeepAliveStrategy();
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java b/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java
+index b647cd3..d67fbf9 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java
+@@ -40,7 +40,8 @@ import javax.net.ssl.SSLException;
+ 
+ import org.apache.http.HttpEntityEnclosingRequest;
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.HttpRequestRetryHandler;
+ import org.apache.http.client.methods.HttpUriRequest;
+ import org.apache.http.client.protocol.HttpClientContext;
+@@ -52,7 +53,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultHttpRequestRetryHandler implements HttpRequestRetryHandler {
+ 
+     public static final DefaultHttpRequestRetryHandler INSTANCE = new DefaultHttpRequestRetryHandler();
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java b/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java
+index 47249ee..7677523 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java
+@@ -39,7 +39,8 @@ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpStatus;
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.CircularRedirectException;
+ import org.apache.http.client.RedirectStrategy;
+ import org.apache.http.client.config.RequestConfig;
+@@ -70,7 +71,7 @@ import org.apache.http.util.TextUtils;
+  * @see LaxRedirectStrategy
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultRedirectStrategy implements RedirectStrategy {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/DefaultServiceUnavailableRetryStrategy.java b/httpclient/src/main/java/org/apache/http/impl/client/DefaultServiceUnavailableRetryStrategy.java
+index f007207..58925d2 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/DefaultServiceUnavailableRetryStrategy.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/DefaultServiceUnavailableRetryStrategy.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.client;
+ 
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpStatus;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.ServiceUnavailableRetryStrategy;
+ import org.apache.http.protocol.HttpContext;
+ import org.apache.http.util.Args;
+@@ -41,7 +42,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.2
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultServiceUnavailableRetryStrategy implements ServiceUnavailableRetryStrategy {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java b/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
+index e2a43c4..b3250ae 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
+@@ -31,7 +31,8 @@ import java.security.Principal;
+ import javax.net.ssl.SSLSession;
+ 
+ import org.apache.http.HttpConnection;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthState;
+ import org.apache.http.auth.Credentials;
+@@ -54,7 +55,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultUserTokenHandler implements UserTokenHandler {
+ 
+     public static final DefaultUserTokenHandler INSTANCE = new DefaultUserTokenHandler();
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/FutureRequestExecutionService.java b/httpclient/src/main/java/org/apache/http/impl/client/FutureRequestExecutionService.java
+index 0fcfd4d..5214917 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/FutureRequestExecutionService.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/FutureRequestExecutionService.java
+@@ -31,7 +31,8 @@ import java.io.IOException;
+ import java.util.concurrent.ExecutorService;
+ import java.util.concurrent.atomic.AtomicBoolean;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.HttpClient;
+ import org.apache.http.client.ResponseHandler;
+ import org.apache.http.client.methods.HttpUriRequest;
+@@ -42,7 +43,7 @@ import org.apache.http.protocol.HttpContext;
+  * HttpAsyncClientWithFuture wraps calls to execute with a {@link HttpRequestFutureTask}
+  * and schedules them using the provided executor service. Scheduled calls may be cancelled.
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class FutureRequestExecutionService implements Closeable {
+ 
+     private final HttpClient httpclient;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/HttpClients.java b/httpclient/src/main/java/org/apache/http/impl/client/HttpClients.java
+index 569b047..7f1b884 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/HttpClients.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/HttpClients.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.client;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.HttpClientConnectionManager;
+ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+ 
+@@ -35,7 +36,7 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+  * Factory methods for {@link CloseableHttpClient} instances.
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class HttpClients {
+ 
+     private HttpClients() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/InternalHttpClient.java b/httpclient/src/main/java/org/apache/http/impl/client/InternalHttpClient.java
+index 32bb5e0..1d57865 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/InternalHttpClient.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/InternalHttpClient.java
+@@ -37,7 +37,8 @@ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthSchemeProvider;
+ import org.apache.http.auth.AuthState;
+ import org.apache.http.client.ClientProtocolException;
+@@ -72,7 +73,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @SuppressWarnings("deprecation")
+ class InternalHttpClient extends CloseableHttpClient implements Configurable {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/LaxRedirectStrategy.java b/httpclient/src/main/java/org/apache/http/impl/client/LaxRedirectStrategy.java
+index 04aa87f..716ea1c 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/LaxRedirectStrategy.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/LaxRedirectStrategy.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.client;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.methods.HttpDelete;
+ import org.apache.http.client.methods.HttpGet;
+ import org.apache.http.client.methods.HttpHead;
+@@ -41,7 +42,7 @@ import org.apache.http.client.methods.HttpPost;
+  *
+  * @since 4.2
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class LaxRedirectStrategy extends DefaultRedirectStrategy {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/MinimalHttpClient.java b/httpclient/src/main/java/org/apache/http/impl/client/MinimalHttpClient.java
+index 6d1ead7..c982d7e 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/MinimalHttpClient.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/MinimalHttpClient.java
+@@ -33,7 +33,8 @@ import java.util.concurrent.TimeUnit;
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.ClientProtocolException;
+ import org.apache.http.client.config.RequestConfig;
+ import org.apache.http.client.methods.CloseableHttpResponse;
+@@ -61,7 +62,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ @SuppressWarnings("deprecation")
+ class MinimalHttpClient extends CloseableHttpClient {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/NoopUserTokenHandler.java b/httpclient/src/main/java/org/apache/http/impl/client/NoopUserTokenHandler.java
+index 9d21a6b..ee20bdc 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/NoopUserTokenHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/NoopUserTokenHandler.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.client;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.UserTokenHandler;
+ import org.apache.http.protocol.HttpContext;
+ 
+@@ -35,7 +36,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class NoopUserTokenHandler implements UserTokenHandler {
+ 
+     public static final NoopUserTokenHandler INSTANCE = new NoopUserTokenHandler();
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/ProxyAuthenticationStrategy.java b/httpclient/src/main/java/org/apache/http/impl/client/ProxyAuthenticationStrategy.java
+index 49e6e91..ce443e9 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/ProxyAuthenticationStrategy.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/ProxyAuthenticationStrategy.java
+@@ -30,7 +30,8 @@ package org.apache.http.impl.client;
+ import java.util.Collection;
+ 
+ import org.apache.http.HttpStatus;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AUTH;
+ import org.apache.http.client.config.RequestConfig;
+ 
+@@ -40,7 +41,7 @@ import org.apache.http.client.config.RequestConfig;
+  *
+  * @since 4.2
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class ProxyAuthenticationStrategy extends AuthenticationStrategyImpl {
+ 
+     public static final ProxyAuthenticationStrategy INSTANCE = new ProxyAuthenticationStrategy();
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java b/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java
+index ae3342b..437e3ea 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java
+@@ -32,7 +32,8 @@ import java.util.Map;
+ import java.util.concurrent.ConcurrentHashMap;
+ 
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * {@link org.apache.http.client.HttpRequestRetryHandler} which assumes
+@@ -45,7 +46,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.2
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class StandardHttpRequestRetryHandler extends DefaultHttpRequestRetryHandler {
+ 
+     private final Map<String, Boolean> idempotentMethods;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java b/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
+index 69c4fde..4e911ac 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
+@@ -33,7 +33,8 @@ import java.util.Map;
+ import java.util.concurrent.ConcurrentHashMap;
+ 
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScope;
+ import org.apache.http.auth.Credentials;
+ import org.apache.http.auth.NTCredentials;
+@@ -48,7 +49,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class SystemDefaultCredentialsProvider implements CredentialsProvider {
+ 
+     private static final Map<String, String> SCHEME_MAP;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/client/TargetAuthenticationStrategy.java b/httpclient/src/main/java/org/apache/http/impl/client/TargetAuthenticationStrategy.java
+index dad2eb7..9fb56e7 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/client/TargetAuthenticationStrategy.java
++++ b/httpclient/src/main/java/org/apache/http/impl/client/TargetAuthenticationStrategy.java
+@@ -30,7 +30,8 @@ package org.apache.http.impl.client;
+ import java.util.Collection;
+ 
+ import org.apache.http.HttpStatus;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AUTH;
+ import org.apache.http.client.config.RequestConfig;
+ 
+@@ -40,7 +41,7 @@ import org.apache.http.client.config.RequestConfig;
+  *
+  * @since 4.2
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class TargetAuthenticationStrategy extends AuthenticationStrategyImpl {
+ 
+     public static final TargetAuthenticationStrategy INSTANCE = new TargetAuthenticationStrategy();
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java b/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
+index 92ca644..e737315 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
+@@ -39,7 +39,8 @@ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.HttpClientConnection;
+ import org.apache.http.HttpHost;
+ import org.apache.http.annotation.GuardedBy;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.config.ConnectionConfig;
+ import org.apache.http.config.Lookup;
+ import org.apache.http.config.Registry;
+@@ -79,7 +80,7 @@ import org.apache.http.util.LangUtils;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class BasicHttpClientConnectionManager implements HttpClientConnectionManager, Closeable {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/CPool.java b/httpclient/src/main/java/org/apache/http/impl/conn/CPool.java
+index 00238e9..3835af6 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/CPool.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/CPool.java
+@@ -31,7 +31,8 @@ import java.util.concurrent.atomic.AtomicLong;
+ 
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.ManagedHttpClientConnection;
+ import org.apache.http.conn.routing.HttpRoute;
+ import org.apache.http.pool.AbstractConnPool;
+@@ -40,7 +41,7 @@ import org.apache.http.pool.ConnFactory;
+ /**
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ class CPool extends AbstractConnPool<HttpRoute, ManagedHttpClientConnection, CPoolEntry> {
+ 
+     private static final AtomicLong COUNTER = new AtomicLong();
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/CPoolEntry.java b/httpclient/src/main/java/org/apache/http/impl/conn/CPoolEntry.java
+index 71f9183..094ee6b 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/CPoolEntry.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/CPoolEntry.java
+@@ -32,7 +32,8 @@ import java.util.concurrent.TimeUnit;
+ 
+ import org.apache.commons.logging.Log;
+ import org.apache.http.HttpClientConnection;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.ManagedHttpClientConnection;
+ import org.apache.http.conn.routing.HttpRoute;
+ import org.apache.http.pool.PoolEntry;
+@@ -40,7 +41,7 @@ import org.apache.http.pool.PoolEntry;
+ /**
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ class CPoolEntry extends PoolEntry<HttpRoute, ManagedHttpClientConnection> {
+ 
+     private final Log log;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/ConnectionShutdownException.java b/httpclient/src/main/java/org/apache/http/impl/conn/ConnectionShutdownException.java
+index b0b6bb6..4925f95 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/ConnectionShutdownException.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/ConnectionShutdownException.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.conn;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals that the connection has been shut down or released back to the
+@@ -35,7 +36,7 @@ import org.apache.http.annotation.Immutable;
+  *
+  * @since 4.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class ConnectionShutdownException extends IllegalStateException {
+ 
+     private static final long serialVersionUID = 5868657401162844497L;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java
+index 5821364..1de8fdc 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java
+@@ -37,7 +37,8 @@ import java.net.SocketTimeoutException;
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.protocol.HttpClientContext;
+ import org.apache.http.config.Lookup;
+ import org.apache.http.config.SocketConfig;
+@@ -60,7 +61,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultHttpClientConnectionOperator implements HttpClientConnectionOperator {
+ 
+     static final String SOCKET_FACTORY_REGISTRY = "http.socket-factory-registry";
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpResponseParserFactory.java b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpResponseParserFactory.java
+index f5c0af0..f6a4427 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpResponseParserFactory.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpResponseParserFactory.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.conn;
+ 
+ import org.apache.http.HttpResponse;
+ import org.apache.http.HttpResponseFactory;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.config.MessageConstraints;
+ import org.apache.http.impl.DefaultHttpResponseFactory;
+ import org.apache.http.io.HttpMessageParser;
+@@ -43,7 +44,7 @@ import org.apache.http.message.LineParser;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultHttpResponseParserFactory implements HttpMessageParserFactory<HttpResponse> {
+ 
+     public static final DefaultHttpResponseParserFactory INSTANCE = new DefaultHttpResponseParserFactory();
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultProxyRoutePlanner.java b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultProxyRoutePlanner.java
+index 376654a..55b2e7e 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultProxyRoutePlanner.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultProxyRoutePlanner.java
+@@ -30,7 +30,8 @@ package org.apache.http.impl.conn;
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.SchemePortResolver;
+ import org.apache.http.protocol.HttpContext;
+ import org.apache.http.util.Args;
+@@ -41,7 +42,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultProxyRoutePlanner extends DefaultRoutePlanner {
+ 
+     private final HttpHost proxy;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultRoutePlanner.java b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultRoutePlanner.java
+index b56d2f8..a61376e 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultRoutePlanner.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultRoutePlanner.java
+@@ -33,7 +33,8 @@ import org.apache.http.HttpException;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.config.RequestConfig;
+ import org.apache.http.client.protocol.HttpClientContext;
+ import org.apache.http.conn.SchemePortResolver;
+@@ -49,7 +50,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultRoutePlanner implements HttpRoutePlanner {
+ 
+     private final SchemePortResolver schemePortResolver;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultSchemePortResolver.java b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultSchemePortResolver.java
+index c5d54ed..8799572 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultSchemePortResolver.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultSchemePortResolver.java
+@@ -27,7 +27,8 @@
+ package org.apache.http.impl.conn;
+ 
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.SchemePortResolver;
+ import org.apache.http.conn.UnsupportedSchemeException;
+ import org.apache.http.util.Args;
+@@ -37,7 +38,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultSchemePortResolver implements SchemePortResolver {
+ 
+     public static final DefaultSchemePortResolver INSTANCE = new DefaultSchemePortResolver();
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java b/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java
+index 2d7d521..9ce8064 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java
+@@ -37,7 +37,8 @@ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpResponse;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.config.ConnectionConfig;
+ import org.apache.http.conn.HttpConnectionFactory;
+ import org.apache.http.conn.ManagedHttpClientConnection;
+@@ -53,7 +54,7 @@ import org.apache.http.io.HttpMessageWriterFactory;
+  * Factory for {@link ManagedHttpClientConnection} instances.
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class ManagedHttpClientConnectionFactory
+         implements HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java b/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
+index ce5de25..9a47d74 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
+@@ -42,7 +42,8 @@ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.HttpClientConnection;
+ import org.apache.http.HttpHost;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.config.ConnectionConfig;
+ import org.apache.http.config.Lookup;
+ import org.apache.http.config.Registry;
+@@ -94,7 +95,7 @@ import org.apache.http.util.Asserts;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class PoolingHttpClientConnectionManager
+     implements HttpClientConnectionManager, ConnPoolControl<HttpRoute>, Closeable {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/SystemDefaultRoutePlanner.java b/httpclient/src/main/java/org/apache/http/impl/conn/SystemDefaultRoutePlanner.java
+index 6b872b9..3f37b6f 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/SystemDefaultRoutePlanner.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/SystemDefaultRoutePlanner.java
+@@ -37,7 +37,8 @@ import java.util.List;
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.SchemePortResolver;
+ import org.apache.http.protocol.HttpContext;
+ 
+@@ -49,7 +50,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class SystemDefaultRoutePlanner extends DefaultRoutePlanner {
+ 
+     private final ProxySelector proxySelector;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/Wire.java b/httpclient/src/main/java/org/apache/http/impl/conn/Wire.java
+index e3bffd3..ff0a685 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/conn/Wire.java
++++ b/httpclient/src/main/java/org/apache/http/impl/conn/Wire.java
+@@ -31,7 +31,8 @@ import java.io.IOException;
+ import java.io.InputStream;
+ 
+ import org.apache.commons.logging.Log;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.util.Args;
+ 
+ /**
+@@ -40,7 +41,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class Wire {
+ 
+     private final Log log;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/AbstractCookieAttributeHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/AbstractCookieAttributeHandler.java
+index ccf12dd..c2b60d4 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/AbstractCookieAttributeHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/AbstractCookieAttributeHandler.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.Cookie;
+ import org.apache.http.cookie.CookieAttributeHandler;
+ import org.apache.http.cookie.CookieOrigin;
+@@ -36,7 +37,7 @@ import org.apache.http.cookie.MalformedCookieException;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public abstract class AbstractCookieAttributeHandler implements CookieAttributeHandler {
+ 
+     @Override
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/AbstractCookieSpec.java b/httpclient/src/main/java/org/apache/http/impl/cookie/AbstractCookieSpec.java
+index 1c6914a..9223161 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/AbstractCookieSpec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/AbstractCookieSpec.java
+@@ -32,7 +32,8 @@ import java.util.HashMap;
+ import java.util.Map;
+ import java.util.concurrent.ConcurrentHashMap;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.CookieAttributeHandler;
+ import org.apache.http.cookie.CookieSpec;
+@@ -47,7 +48,7 @@ import org.apache.http.util.Asserts;
+  *
+  * @since 4.0
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public abstract class AbstractCookieSpec implements CookieSpec {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicCommentHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/BasicCommentHandler.java
+index 14c9cfe..2ab5fb9 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicCommentHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/BasicCommentHandler.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.MalformedCookieException;
+@@ -37,7 +38,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class BasicCommentHandler extends AbstractCookieAttributeHandler implements CommonCookieAttributeHandler {
+ 
+     public BasicCommentHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicDomainHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/BasicDomainHandler.java
+index 7503971..9da1536 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicDomainHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/BasicDomainHandler.java
+@@ -28,7 +28,8 @@ package org.apache.http.impl.cookie;
+ 
+ import java.util.Locale;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.util.InetAddressUtils;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+@@ -44,7 +45,7 @@ import org.apache.http.util.TextUtils;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class BasicDomainHandler implements CommonCookieAttributeHandler {
+ 
+     public BasicDomainHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicExpiresHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/BasicExpiresHandler.java
+index 21a2876..9ede499 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicExpiresHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/BasicExpiresHandler.java
+@@ -28,7 +28,8 @@ package org.apache.http.impl.cookie;
+ 
+ import java.util.Date;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.utils.DateUtils;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+@@ -40,7 +41,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class BasicExpiresHandler extends AbstractCookieAttributeHandler implements CommonCookieAttributeHandler {
+ 
+     /** Valid date patterns */
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicMaxAgeHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/BasicMaxAgeHandler.java
+index 02ee8ba..36cc2af 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicMaxAgeHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/BasicMaxAgeHandler.java
+@@ -28,7 +28,8 @@ package org.apache.http.impl.cookie;
+ 
+ import java.util.Date;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.MalformedCookieException;
+@@ -39,7 +40,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class BasicMaxAgeHandler extends AbstractCookieAttributeHandler implements CommonCookieAttributeHandler {
+ 
+     public BasicMaxAgeHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicPathHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/BasicPathHandler.java
+index c7b3875..64f4c2f 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicPathHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/BasicPathHandler.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+@@ -41,7 +42,7 @@ import org.apache.http.util.TextUtils;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class BasicPathHandler implements CommonCookieAttributeHandler {
+ 
+     public BasicPathHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicSecureHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/BasicSecureHandler.java
+index 5b8f55c..97e68ff 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicSecureHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/BasicSecureHandler.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+@@ -39,7 +40,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class BasicSecureHandler extends AbstractCookieAttributeHandler implements CommonCookieAttributeHandler {
+ 
+     public BasicSecureHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java b/httpclient/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java
+index f4f98f1..1b2b891 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java
+@@ -34,7 +34,8 @@ import java.util.Locale;
+ 
+ import org.apache.http.HeaderElement;
+ import org.apache.http.NameValuePair;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+ import org.apache.http.cookie.CookieAttributeHandler;
+@@ -47,7 +48,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public abstract class CookieSpecBase extends AbstractCookieSpec {
+ 
+     public CookieSpecBase() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/DefaultCookieSpec.java b/httpclient/src/main/java/org/apache/http/impl/cookie/DefaultCookieSpec.java
+index bd571ce..f24e163 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/DefaultCookieSpec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/DefaultCookieSpec.java
+@@ -32,7 +32,8 @@ import java.util.List;
+ import org.apache.http.FormattedHeader;
+ import org.apache.http.Header;
+ import org.apache.http.HeaderElement;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.Cookie;
+ import org.apache.http.cookie.CookieOrigin;
+ import org.apache.http.cookie.CookieSpec;
+@@ -49,7 +50,7 @@ import org.apache.http.util.CharArrayBuffer;
+  *
+  * @since 4.4
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class DefaultCookieSpec implements CookieSpec {
+ 
+     private final RFC2965Spec strict;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/DefaultCookieSpecProvider.java b/httpclient/src/main/java/org/apache/http/impl/cookie/DefaultCookieSpecProvider.java
+index 1fe8f03..2b73911 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/DefaultCookieSpecProvider.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/DefaultCookieSpecProvider.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.util.PublicSuffixMatcher;
+ import org.apache.http.cookie.Cookie;
+ import org.apache.http.cookie.CookieOrigin;
+@@ -43,7 +44,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class DefaultCookieSpecProvider implements CookieSpecProvider {
+ 
+     public enum CompatibilityLevel {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpec.java b/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpec.java
+index 71bf790..834a6e0 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpec.java
+@@ -31,7 +31,8 @@ import java.util.Collections;
+ import java.util.List;
+ 
+ import org.apache.http.Header;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.Cookie;
+ import org.apache.http.cookie.CookieOrigin;
+ import org.apache.http.cookie.MalformedCookieException;
+@@ -41,7 +42,7 @@ import org.apache.http.cookie.MalformedCookieException;
+  *
+  * @since 4.1
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class IgnoreSpec extends CookieSpecBase {
+ 
+     @Override
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecProvider.java b/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecProvider.java
+index 97bedf6..980a34e 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecProvider.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecProvider.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.CookieSpec;
+ import org.apache.http.cookie.CookieSpecProvider;
+ import org.apache.http.protocol.HttpContext;
+@@ -37,7 +38,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class IgnoreSpecProvider implements CookieSpecProvider {
+ 
+     private volatile CookieSpec cookieSpec;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/LaxExpiresHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/LaxExpiresHandler.java
+index 82e891c..f60b127 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/LaxExpiresHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/LaxExpiresHandler.java
+@@ -35,7 +35,8 @@ import java.util.concurrent.ConcurrentHashMap;
+ import java.util.regex.Matcher;
+ import java.util.regex.Pattern;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.MalformedCookieException;
+@@ -47,7 +48,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class LaxExpiresHandler extends AbstractCookieAttributeHandler implements CommonCookieAttributeHandler {
+ 
+     static final TimeZone UTC = TimeZone.getTimeZone("UTC");
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/LaxMaxAgeHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/LaxMaxAgeHandler.java
+index 8615286..cd95e1f 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/LaxMaxAgeHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/LaxMaxAgeHandler.java
+@@ -30,7 +30,8 @@ import java.util.Date;
+ import java.util.regex.Matcher;
+ import java.util.regex.Pattern;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.MalformedCookieException;
+@@ -42,7 +43,7 @@ import org.apache.http.util.TextUtils;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class LaxMaxAgeHandler extends AbstractCookieAttributeHandler implements CommonCookieAttributeHandler {
+ 
+     private final static Pattern MAX_AGE_PATTERN = Pattern.compile("^\\-?[0-9]+$");
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java
+index 1f92cc0..fbb808d 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.cookie;
+ import java.util.Locale;
+ import java.util.StringTokenizer;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.Cookie;
+ import org.apache.http.cookie.CookieOrigin;
+@@ -43,7 +44,7 @@ import org.apache.http.util.TextUtils;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class NetscapeDomainHandler extends BasicDomainHandler {
+ 
+     public NetscapeDomainHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftHeaderParser.java b/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftHeaderParser.java
+index a6a40de..0f7217e 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftHeaderParser.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftHeaderParser.java
+@@ -34,7 +34,8 @@ import java.util.List;
+ import org.apache.http.HeaderElement;
+ import org.apache.http.NameValuePair;
+ import org.apache.http.ParseException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.message.BasicHeaderElement;
+ import org.apache.http.message.BasicNameValuePair;
+ import org.apache.http.message.ParserCursor;
+@@ -46,7 +47,7 @@ import org.apache.http.util.CharArrayBuffer;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class NetscapeDraftHeaderParser {
+ 
+     public final static NetscapeDraftHeaderParser DEFAULT = new NetscapeDraftHeaderParser();
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpec.java b/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpec.java
+index caedd83..a9f1fc9 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpec.java
+@@ -34,7 +34,8 @@ import org.apache.http.FormattedHeader;
+ import org.apache.http.Header;
+ import org.apache.http.HeaderElement;
+ import org.apache.http.annotation.Obsolete;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+ import org.apache.http.cookie.CookieOrigin;
+@@ -57,7 +58,7 @@ import org.apache.http.util.CharArrayBuffer;
+  * @see org.apache.http.impl.cookie.RFC6265LaxSpec
+  */
+ @Obsolete
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class NetscapeDraftSpec extends CookieSpecBase {
+ 
+     protected static final String EXPIRES_PATTERN = "EEE, dd-MMM-yy HH:mm:ss z";
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecProvider.java b/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecProvider.java
+index f4832f7..bef6d74 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecProvider.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecProvider.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.annotation.Obsolete;
+ import org.apache.http.cookie.CookieSpec;
+ import org.apache.http.cookie.CookieSpecProvider;
+@@ -44,7 +45,7 @@ import org.apache.http.protocol.HttpContext;
+  * @see org.apache.http.impl.cookie.RFC6265CookieSpecProvider
+  */
+ @Obsolete
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class NetscapeDraftSpecProvider implements CookieSpecProvider {
+ 
+     private final String[] datepatterns;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java b/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java
+index 062f8ec..b72043c 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.cookie;
+ import java.util.Map;
+ import java.util.concurrent.ConcurrentHashMap;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.util.PublicSuffixList;
+ import org.apache.http.conn.util.PublicSuffixMatcher;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+@@ -50,7 +51,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.4
+  */
+- at Immutable // dependencies are expected to be immutable or thread-safe
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL) // dependencies are expected to be immutable or thread-safe
+ public class PublicSuffixDomainFilter implements CommonCookieAttributeHandler {
+ 
+     private final CommonCookieAttributeHandler handler;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java
+index fdbeb15..8e314fc 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java
+@@ -28,7 +28,8 @@ package org.apache.http.impl.cookie;
+ 
+ import java.util.Locale;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+@@ -42,7 +43,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RFC2109DomainHandler implements CommonCookieAttributeHandler {
+ 
+     public RFC2109DomainHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java
+index 1b4e783..438e469 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java
+@@ -34,7 +34,8 @@ import java.util.List;
+ import org.apache.http.Header;
+ import org.apache.http.HeaderElement;
+ import org.apache.http.annotation.Obsolete;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.utils.DateUtils;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+@@ -57,7 +58,7 @@ import org.apache.http.util.CharArrayBuffer;
+  * @see org.apache.http.impl.cookie.RFC6265StrictSpec
+  */
+ @Obsolete
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class RFC2109Spec extends CookieSpecBase {
+ 
+     final static String[] DATE_PATTERNS = {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecProvider.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecProvider.java
+index c7f9724..b38c306 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecProvider.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecProvider.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.annotation.Obsolete;
+ import org.apache.http.conn.util.PublicSuffixMatcher;
+ import org.apache.http.cookie.CookieSpec;
+@@ -45,7 +46,7 @@ import org.apache.http.protocol.HttpContext;
+  * @see org.apache.http.impl.cookie.RFC6265CookieSpecProvider
+  */
+ @Obsolete
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RFC2109SpecProvider implements CookieSpecProvider {
+ 
+     private final PublicSuffixMatcher publicSuffixMatcher;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109VersionHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109VersionHandler.java
+index a342e85..4adfd66 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109VersionHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109VersionHandler.java
+@@ -26,7 +26,8 @@
+  */
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+@@ -40,7 +41,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RFC2109VersionHandler extends AbstractCookieAttributeHandler implements CommonCookieAttributeHandler {
+ 
+     public RFC2109VersionHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965CommentUrlAttributeHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965CommentUrlAttributeHandler.java
+index dd739bc..b42758f 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965CommentUrlAttributeHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965CommentUrlAttributeHandler.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+@@ -41,7 +42,7 @@ import org.apache.http.cookie.SetCookie2;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RFC2965CommentUrlAttributeHandler implements CommonCookieAttributeHandler {
+ 
+       public RFC2965CommentUrlAttributeHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965DiscardAttributeHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965DiscardAttributeHandler.java
+index 62d1f45..915f7b0 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965DiscardAttributeHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965DiscardAttributeHandler.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+@@ -41,7 +42,7 @@ import org.apache.http.cookie.SetCookie2;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RFC2965DiscardAttributeHandler implements CommonCookieAttributeHandler {
+ 
+       public RFC2965DiscardAttributeHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java
+index 42e790e..2047617 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.cookie;
+ 
+ import java.util.Locale;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+@@ -45,7 +46,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 3.1
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RFC2965DomainAttributeHandler implements CommonCookieAttributeHandler {
+ 
+     public RFC2965DomainAttributeHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965PortAttributeHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965PortAttributeHandler.java
+index 004f254..fbb13a1 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965PortAttributeHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965PortAttributeHandler.java
+@@ -29,7 +29,8 @@ package org.apache.http.impl.cookie;
+ 
+ import java.util.StringTokenizer;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+@@ -45,7 +46,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RFC2965PortAttributeHandler implements CommonCookieAttributeHandler {
+ 
+     public RFC2965PortAttributeHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java
+index ca836c1..5ffca30 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java
+@@ -36,7 +36,8 @@ import org.apache.http.Header;
+ import org.apache.http.HeaderElement;
+ import org.apache.http.NameValuePair;
+ import org.apache.http.annotation.Obsolete;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+@@ -57,7 +58,7 @@ import org.apache.http.util.CharArrayBuffer;
+  * @see org.apache.http.impl.cookie.RFC6265StrictSpec
+  */
+ @Obsolete
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class RFC2965Spec extends RFC2109Spec {
+ 
+     /**
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecProvider.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecProvider.java
+index ba303a6..ff4d555 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecProvider.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecProvider.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.annotation.Obsolete;
+ import org.apache.http.conn.util.PublicSuffixMatcher;
+ import org.apache.http.cookie.CookieSpec;
+@@ -45,7 +46,7 @@ import org.apache.http.protocol.HttpContext;
+  * @see org.apache.http.impl.cookie.RFC6265CookieSpecProvider
+  */
+ @Obsolete
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RFC2965SpecProvider implements CookieSpecProvider {
+ 
+     private final PublicSuffixMatcher publicSuffixMatcher;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965VersionAttributeHandler.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965VersionAttributeHandler.java
+index ac682d8..c5ce0f6 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965VersionAttributeHandler.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965VersionAttributeHandler.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+@@ -43,7 +44,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RFC2965VersionAttributeHandler implements CommonCookieAttributeHandler {
+ 
+     public RFC2965VersionAttributeHandler() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpec.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpec.java
+index 22d7d1d..6f0561d 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpec.java
+@@ -39,7 +39,8 @@ import java.util.concurrent.ConcurrentHashMap;
+ 
+ import org.apache.http.FormattedHeader;
+ import org.apache.http.Header;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.ClientCookie;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ import org.apache.http.cookie.Cookie;
+@@ -60,7 +61,7 @@ import org.apache.http.util.CharArrayBuffer;
+  *
+  * @since 4.5
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class RFC6265CookieSpec implements CookieSpec {
+ 
+     private final static char PARAM_DELIMITER  = ';';
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpecProvider.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpecProvider.java
+index e4f24dc..8a41bea 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpecProvider.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpecProvider.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.conn.util.PublicSuffixMatcher;
+ import org.apache.http.cookie.Cookie;
+ import org.apache.http.cookie.CookieOrigin;
+@@ -43,7 +44,7 @@ import org.apache.http.protocol.HttpContext;
+  *
+  * @since 4.4
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RFC6265CookieSpecProvider implements CookieSpecProvider {
+ 
+     public enum CompatibilityLevel {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265LaxSpec.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265LaxSpec.java
+index 8455c83..1653e9f 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265LaxSpec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265LaxSpec.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ 
+ /**
+@@ -38,7 +39,7 @@ import org.apache.http.cookie.CommonCookieAttributeHandler;
+  *
+  * @since 4.4
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class RFC6265LaxSpec extends RFC6265CookieSpecBase {
+ 
+     public RFC6265LaxSpec() {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265StrictSpec.java b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265StrictSpec.java
+index 1765d27..f1f5b77 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265StrictSpec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265StrictSpec.java
+@@ -27,7 +27,8 @@
+ 
+ package org.apache.http.impl.cookie;
+ 
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.utils.DateUtils;
+ import org.apache.http.cookie.CommonCookieAttributeHandler;
+ 
+@@ -38,7 +39,7 @@ import org.apache.http.cookie.CommonCookieAttributeHandler;
+  *
+  * @since 4.4
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class RFC6265StrictSpec extends RFC6265CookieSpecBase {
+ 
+     final static String[] DATE_PATTERNS = {
+diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/BackoffStrategyExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/BackoffStrategyExec.java
+index 7c9025b..697a9bd 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/execchain/BackoffStrategyExec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/execchain/BackoffStrategyExec.java
+@@ -31,7 +31,8 @@ import java.io.IOException;
+ import java.lang.reflect.UndeclaredThrowableException;
+ 
+ import org.apache.http.HttpException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.BackoffManager;
+ import org.apache.http.client.ConnectionBackoffStrategy;
+ import org.apache.http.client.methods.CloseableHttpResponse;
+@@ -44,7 +45,7 @@ import org.apache.http.util.Args;
+ /**
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class BackoffStrategyExec implements ClientExecChain {
+ 
+     private final ClientExecChain requestExecutor;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java b/httpclient/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java
+index 0f6e4f3..0cdf9e0 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java
++++ b/httpclient/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java
+@@ -34,7 +34,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
+ 
+ import org.apache.commons.logging.Log;
+ import org.apache.http.HttpClientConnection;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.concurrent.Cancellable;
+ import org.apache.http.conn.ConnectionReleaseTrigger;
+ import org.apache.http.conn.HttpClientConnectionManager;
+@@ -44,7 +45,7 @@ import org.apache.http.conn.HttpClientConnectionManager;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ class ConnectionHolder implements ConnectionReleaseTrigger, Cancellable, Closeable {
+ 
+     private final Log log;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
+index 9496813..0ce6845 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
+@@ -42,7 +42,8 @@ import org.apache.http.HttpException;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpResponse;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AUTH;
+ import org.apache.http.auth.AuthProtocolState;
+ import org.apache.http.auth.AuthState;
+@@ -84,7 +85,7 @@ import org.apache.http.util.EntityUtils;
+  * @since 4.3
+  */
+ @SuppressWarnings("deprecation")
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class MainClientExec implements ClientExecChain {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
+index adca0a2..d8a1f1b 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
+@@ -44,7 +44,8 @@ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.config.RequestConfig;
+ import org.apache.http.client.methods.CloseableHttpResponse;
+ import org.apache.http.client.methods.HttpExecutionAware;
+@@ -77,7 +78,7 @@ import org.apache.http.util.VersionInfo;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class MinimalClientExec implements ClientExecChain {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
+index 0f9b75c..9238fcf 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
+@@ -37,7 +37,8 @@ import org.apache.http.HttpException;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScope;
+ import org.apache.http.auth.UsernamePasswordCredentials;
+ import org.apache.http.client.CredentialsProvider;
+@@ -69,7 +70,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ @SuppressWarnings("deprecation")
+ public class ProtocolExec implements ClientExecChain {
+ 
+diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
+index dcafdb5..023e84f 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
+@@ -38,7 +38,8 @@ import org.apache.http.HttpException;
+ import org.apache.http.HttpHost;
+ import org.apache.http.HttpRequest;
+ import org.apache.http.ProtocolException;
+-import org.apache.http.annotation.ThreadSafe;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.auth.AuthScheme;
+ import org.apache.http.auth.AuthState;
+ import org.apache.http.client.RedirectException;
+@@ -65,7 +66,7 @@ import org.apache.http.util.EntityUtils;
+  *
+  * @since 4.3
+  */
+- at ThreadSafe
++ at Contract(threading = ThreadingBehavior.SAFE)
+ public class RedirectExec implements ClientExecChain {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/RequestAbortedException.java b/httpclient/src/main/java/org/apache/http/impl/execchain/RequestAbortedException.java
+index 2a3d0a5..fb894e4 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/execchain/RequestAbortedException.java
++++ b/httpclient/src/main/java/org/apache/http/impl/execchain/RequestAbortedException.java
+@@ -29,14 +29,15 @@ package org.apache.http.impl.execchain;
+ 
+ import java.io.InterruptedIOException;
+ 
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals that the request has been aborted.
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RequestAbortedException extends InterruptedIOException {
+ 
+     private static final long serialVersionUID = 4973849966012490112L;
+diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java
+index cade164..9a53bdf 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java
+@@ -34,7 +34,8 @@ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.Header;
+ import org.apache.http.HttpException;
+ import org.apache.http.NoHttpResponseException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.HttpRequestRetryHandler;
+ import org.apache.http.client.NonRepeatableRequestException;
+ import org.apache.http.client.methods.CloseableHttpResponse;
+@@ -56,7 +57,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class RetryExec implements ClientExecChain {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
+index 6fb6ef3..b080234 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
++++ b/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
+@@ -34,7 +34,8 @@ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.http.Header;
+ import org.apache.http.HttpException;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ import org.apache.http.client.ServiceUnavailableRetryStrategy;
+ import org.apache.http.client.methods.CloseableHttpResponse;
+ import org.apache.http.client.methods.HttpExecutionAware;
+@@ -55,7 +56,7 @@ import org.apache.http.util.Args;
+  *
+  * @since 4.3
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class ServiceUnavailableRetryExec implements ClientExecChain {
+ 
+     private final Log log = LogFactory.getLog(getClass());
+diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/TunnelRefusedException.java b/httpclient/src/main/java/org/apache/http/impl/execchain/TunnelRefusedException.java
+index cff1e07..e582241 100644
+--- a/httpclient/src/main/java/org/apache/http/impl/execchain/TunnelRefusedException.java
++++ b/httpclient/src/main/java/org/apache/http/impl/execchain/TunnelRefusedException.java
+@@ -29,14 +29,15 @@ package org.apache.http.impl.execchain;
+ 
+ import org.apache.http.HttpException;
+ import org.apache.http.HttpResponse;
+-import org.apache.http.annotation.Immutable;
++import org.apache.http.annotation.ThreadingBehavior;
++import org.apache.http.annotation.Contract;
+ 
+ /**
+  * Signals that the tunnel request was rejected by the proxy host.
+  *
+  * @since 4.0
+  */
+- at Immutable
++ at Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
+ public class TunnelRefusedException extends HttpException {
+ 
+     private static final long serialVersionUID = -8646722842745617323L;
diff --git a/debian/patches/series b/debian/patches/series
index b59251d..71a17cd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 01-generate_osgi_metadata.patch
 02-include-suffix-list.patch
+httpcore-ThreadSafe.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/httpcomponents-client.git



More information about the pkg-java-commits mailing list