Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.net.URI;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.Set;

Expand Down Expand Up @@ -106,14 +105,7 @@ private URI checkDockerHostScheme(URI dockerHost) {
if (dockerHost == null) {
throw new DockerClientException("'dockerHost' is null");
}
switch (Objects.toString(dockerHost.getScheme())) {
case "tcp":
case "unix":
case "npipe":
return dockerHost;
default:
throw new DockerClientException("Unsupported protocol scheme found: '" + dockerHost);
}
return dockerHost;
}

private static Properties loadIncludedDockerProperties(Properties systemProperties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ protected ApacheDockerHttpClientImpl(
);
break;
default:
pathPrefix = "";
host = HttpHost.create(dockerHost);
throw new IllegalArgumentException("Unsupported protocol scheme: " + dockerHost);
}

PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private OkDockerHttpClient(
}
break;
default:
baseUrlBuilder = HttpUrl.get(dockerHost.toString()).newBuilder();
throw new IllegalArgumentException("Unsupported protocol scheme: " + dockerHost);
}
baseUrl = baseUrlBuilder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
Expand Down Expand Up @@ -172,28 +173,11 @@ public void testTlsVerifyAndCertPath() throws Exception {
new LocalDirectorySSLConfig(dockerCertPath()));
}

@Test(expected = DockerClientException.class)
public void testWrongHostScheme() throws Exception {
new DefaultDockerClientConfig(URI.create("http://foo"), "dockerConfig", "apiVersion", "registryUrl", "registryUsername", "registryPassword", "registryEmail",
null);
}

@Test()
public void testTcpHostScheme() throws Exception {
new DefaultDockerClientConfig(URI.create("tcp://foo"), "dockerConfig", "apiVersion", "registryUrl", "registryUsername", "registryPassword", "registryEmail",
null);
}

@Test()
public void testUnixHostScheme() throws Exception {
new DefaultDockerClientConfig(URI.create("unix://foo"), "dockerConfig", "apiVersion", "registryUrl", "registryUsername", "registryPassword", "registryEmail",
null);
}

@Test()
public void testNpipeHostScheme() throws Exception {
new DefaultDockerClientConfig(URI.create("npipe://foo"), "dockerConfig", "apiVersion", "registryUrl", "registryUsername", "registryPassword", "registryEmail",
null);
public void testAnyHostScheme() throws Exception {
URI dockerHost = URI.create(UUID.randomUUID().toString().replace("-", "") + "://foo");
new DefaultDockerClientConfig(dockerHost, "dockerConfig", "apiVersion", "registryUrl", "registryUsername", "registryPassword", "registryEmail",
null);
}

@Test
Expand Down