chore(core): own the Docker HTTP transport, with docker-java's settings unchanged (#5170)

* chore(core): own the Docker HTTP transport, with docker-java's settings unchanged

docker-java's ApacheDockerHttpClient builder exposes only the host, SSL
config, pool size and the connect and response timeouts. Idle-connection
validation and eviction, and a timeout for leasing a pooled connection, are
set inside a private constructor, so Floci cannot reach them.

FlociDockerHttpClient and HijackingHttpRequestExecutor are adapted from
docker-java 3.7.1's httpclient5 transport and apply exactly its settings:
unix, npipe and tcp hosts, TLS from the SSL config, a single-route pool, no
pooled socket read timeout, the request response timeout, no stale-connection
validation, and the hijacked exec/attach upgrade. DockerClientProducer builds
both pools with it. Nothing changes behaviour here; follow-ups turn on idle
validation and the lease timeout on this class.

docker-java is Apache License 2.0 and ships no NOTICE file, so the
obligations are the licence text, added as licenses/Apache-2.0.txt, and the
attribution, which each adapted file's header gives along with what changed.

* chore(core): pick the Docker host and path prefix with a switch expression
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-06 07:00:11 -04:00
1 parent 4115becdf2
commit df958117bb
5 files changed
+638 -5

No files matched your search

@@ -4,7 +4,6 @@ import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.async.ResultCallback;
import com.github.dockerjava.api.model.Frame;
import com.github.dockerjava.core.DefaultDockerClientConfig;
import com.github.dockerjava.httpclient5.ApacheDockerHttpClient;
import io.github.hectorvent.floci.config.EmulatorConfig;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
@@ -753,7 +752,7 @@ class DockerClientProducerTest {
.withDockerTlsVerify(false)
.build();
try (ApacheDockerHttpClient client = DockerClientProducer.newHttpClient(plainConfig, 10)) {
try (FlociDockerHttpClient client = DockerClientProducer.newHttpClient(plainConfig, 10)) {
assertNull(plainConfig.getSSLConfig(), "a config without TLS verify carries no SSL config");
assertEquals("tcp://127.0.0.1:2375", plainConfig.getDockerHost().toString());
}