I am trying to make use of the CXF asynchronous HTTP client transport, through setting the "use.async.http.conduit" property, as detailed in this thread, and recommended by this CXF article.
I do that using the following code:
Client client = ClientProxy.getClient(wsClient);
client.getRequestContext().put("use.async.http.conduit", Boolean.TRUE);
As it happens, my web service call is timing out (probably due to some environmental network issue), and my client exception contains (extract):
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:698)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:641)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1218)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:260)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1513)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1486)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1305)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:623)
The exception stack above suggests that the java.net.HttpURLConnection
class is still in use and that based on the CXF documentation the setting has not taken effect.
What I am trying to figure out is how to ensure that the "use.async.http.conduit" has taken effect, i.e. is there a particular behaviour that can be tested, or a particular log config that I can enable on the client that would undoubtedly tell me the Apache HttpAsyncClient is in use?
Many thanks :)