- All Implemented Interfaces:
HttpTransport
HttpTransport, used when no transport is injected.
This is the only class in the SDK's new transport layer that names java.net.http,
and it always names it fully qualified — the SDK's own HttpRequest and HttpResponse
live in this package and would otherwise be ambiguous to a reader. Please do not "tidy" the qualified
names into imports. Keeping every java.net.http reference inside this one class is also what
lets an Android application inject an OkHttp-backed transport and never load this class, on a
platform where java.net.http does not exist at any API level.
-
Method Summary
Modifier and TypeMethodDescriptionvoidRelease whatever this transport owns, within a bounded grace period.static DefaultHttpTransportcreate(HttpTransportConfiguration configuration) Build a transport with a private connection pool, so pool limits and TLS settings belong to the SDK and are not affected by anything else in the process.roundTrip(HttpRequest request, Cancellation cancellation) Perform one exchange.
-
Method Details
-
create
Build a transport with a private connection pool, so pool limits and TLS settings belong to the SDK and are not affected by anything else in the process.The pool is private but not isolated from the environment: like the JDK's own default client it honours the
http.proxyHostfamily of system properties.- Parameters:
configuration- how to build it- Returns:
- the new transport
-
roundTrip
Description copied from interface:HttpTransportPerform one exchange.Never throws: a failure completes the returned stage exceptionally with an
HttpTransportException.- Specified by:
roundTripin interfaceHttpTransport- Parameters:
request- the request to performcancellation- the caller's cancellation;Cancellation.none()when there is none. An implementation must release its registration when the exchange ends.- Returns:
- a stage completing with the response, or exceptionally with an
HttpTransportException
-
close
Description copied from interface:HttpTransportRelease whatever this transport owns, within a bounded grace period.Not asynchronous, because every SDK's
Client.close()is synchronous and making this one asynchronous would make that one asynchronous too.- Specified by:
closein interfaceHttpTransport- Parameters:
closeTimeout- how long to wait for exchanges already in flight before cancelling them
-