Add a PersistentSyncHttpClient class, which is a wrapper around
CloseableHttpAsyncClient and allows multiple requests to be made
with a persistent synchronous client.
Separate the Java RequestOptions class into two new classes:
RequestOptions, which contains options related to the request,
and ClientOptions, which contains options related to the client.
Both are now required when calling the request methods in
AsyncHttpClient and SyncHttpClient.
The test code related to the configurable SSL protocols was
written using some ciphers that are available in OpenJDK, but
are not available by default in Oracle JDK. This caused the
tests to fail on Oracle JDKs.
This commit changes the test to use some older ciphers that
are available in the Oracle JDK out of the box.
This commit moves each close call made on a `CloseableHttpAsyncClient`
from the thread on which the request callback is made over to a
different thread in order to avoid a deadlock.
Previously, the client close call was made in the context of thread from
which the callback was invoked. The Apache HTTP async client library
makes these calls from one of its i/o reactor threads. In the case of a
"failed" request, e.g., failure to make the client connection, this call
occurs in the context of the primary i/o reactor thread. The client
close call does an indefinite join on the primary i/o reactor thread
and, therefore, this call causes a deadlock. The client never closes
and all resources associated with it - threads, file descriptors, etc. -
remain open until the process is shutdown.
This commit introduces a new class, `AsyncClose`, which manages a small,
fixed size thread pool from which client close calls can be executed.
The `async` Clojure and `JavaClient` APIs were updated to use `AsyncClose`
whenever a client needs to be closed from a callback.
This commit adds configuration settings for the SSL protocols
and cipher suites, in both the java and clojure clients. It
also adds a list of default protocols which will be used if
the protocols setting is not explicitly set.
Prior to this commit, we were using `HttpAsyncClientBuilder.setSSLContext`
to set up our HTTPS SSL configuration. That method doesn't provide
a mechanism for specifying a list of acceptable protocols or ciphers.
This commit simply ports the code over to use `.setSSLStrategy`
instead, because it allows a larger number of configuration options.
This commit removes an unnecessary build() method call made on the
HttpAsyncClientBuilder in JavaClient's createClient() method.
Previously, the presence of this call would cause an extra
CloseableHttpAsyncClient object to be created. Since close() was never
called on the extra client object, native file descriptor resources were
never freed even after the object fell out of scope.
This commit contains two changes:
* Revert the Pascal-casing of the `Accept-Encoding` header added to
async.clj
* Use `.toString` method on the `Content-Type` class to handle the
serialization of the `Content-Type` header value
This commit encodes a request body string per the content of the
Content-Type header. In the event that no charset is specified in the
Content-Type header, the charset is set to UTF-8. Previously, the
request body string was always encoded to ISO-8859-1 and was not
necessarily in sync with the value of the Content-Type header.