I'm working on a long-overdue upgrade of HttpClient5 from the 5.2 series to 5.4.3. I've noticed that ConnectionSocketFactory has been deprecated. This interface was previously responsible for both creating sockets, as well as upgrading existing sockets to TLS; the latter functionality was exposed through a subinterface, namely LayeredConnectionSocketFactory.
The responsibilities of LayeredConnectionSocketFactory (LCSF) have been moved to a new interface called TlsSocketStrategy. If you provide a Registry<ConnectionSocketFactory> when building a connection manager, it will be wrapped in an adapter that allows LCSF implementations to be called through the TlsSocketStrategy interface. However, all other ConnectionSocketFactory (CSF) implementations are ignored. I actually have quite a few use cases for CSF customization: 1. TLS handshake timeouts. This works by setting soTimeout on the underlying socket to the handshake timeout value, calling a delegate LCSF to upgrade the socket, and then restoring the socket's old soTimeout value. 2. Connection count metrics. This is a trivial CSF implementation that wraps a delegate and emits a metric whenever connectSocket() is called. 3. Unix domain socket support. This is a CSF implementation that calls JUnixSocket to create UDS. I see how (1) can be migrated to the new TlsSocketStrategy API (although it lacks a connectTimeout parameter, which is a problem), so I'm not worried about that, but I'm more concerned about (2) and (3). In httpclient 5.4, if I want to take control of Socket creation, it looks like I have to use internal APIs like DetachedSocketFactory and HttpClientConnectionOperator. My questions are: - Does the synchronous client support TLS handshake timeouts in 5.4? (My integration tests indicate that the default behavior is the same as in 5.2.) - Have I overlooked any public APIs that could accommodate use cases (2) and (3) above? - Could we expose DetachedSocketFactory (or something similar) as a stable interface for client customization? If so, could such a change be released as part of 5.4.4, or would it have to go into 5.5? I am of course willing to contribute the necessary changes myself, once there's agreement on what they should look like. - Ryan --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org