-
public final class HttpClientLow-level executor for a single HTTP request over the platform HttpURLConnection — the sole network transport for every SDK-to-server exchange (attribution, in-app events, conversion data, remote config, purchase validation, OneLink). The SDK deliberately uses
HttpURLConnectionand not OkHttp, so no third-party networking dependency is pulled in (feature F-013).A fresh connection is opened and disconnected per call — there is no connection pooling. Application code never touches this class directly: a Task builds a Call through
ApiCallFactory, andCall.execute()is what reaches executeRequest.
-
-
Constructor Summary
Constructors Constructor Description HttpClient(Integer requestTimeoutMillis)
-
Method Summary
Modifier and Type Method Description final Response<String>executeRequest(Request request)Opens the connection, applies the request's method/headers/timeout/cache/redirect settings, writes the body (if any), reads the response, and returns it on the calling thread. -
-
Constructor Detail
-
HttpClient
HttpClient(Integer requestTimeoutMillis)
- Parameters:
requestTimeoutMillis- default connect/read timeout applied to every request, unless the individual Request overrides it via Request.timeoutMillis.
-
-
Method Detail
-
executeRequest
final Response<String> executeRequest(Request request)
Opens the connection, applies the request's method/headers/timeout/cache/redirect settings, writes the body (if any), reads the response, and returns it on the calling thread. The
Content-Typeisapplication/octet-streamfor encrypted payloads andapplication/jsonotherwise. A 2xx status marks the Response as successful.The whole body is wrapped in
try/catch (Throwable), notcatch (Exception): ajava.lang.Errorsubclass thrown by the underlying stack (e.g.NoClassDefFoundError,OutOfMemoryError) must be caught here and surfaced as an HttpException so it never escapes a background SDK task and crashes the host app — see IC-141. The connection is always disconnected infinally.
-
-
-
-