add ConnectionSpec.CLEARTEXT for DockerEngine running w/t TLS

This commit is contained in:
Andrea Turli 2015-05-01 16:03:59 +02:00
parent e4477e579a
commit 26d925c2de
4 changed files with 17 additions and 27 deletions

View File

@ -131,8 +131,6 @@ public class DockerTemplateOptions extends TemplateOptions implements Cloneable
.toString();
}
public static final DockerTemplateOptions NONE = new DockerTemplateOptions();
public DockerTemplateOptions volumes(Map<String, String> volumes) {
this.volumes = Optional.<Map<String, String>>of(ImmutableMap.copyOf(checkNotNull(volumes, "volumes")));
return this;

View File

@ -16,6 +16,9 @@
*/
package org.jclouds.docker.config;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.docker.suppliers.SSLContextWithKeysSupplier;
import org.jclouds.http.okhttp.OkHttpClientSupplier;
@ -23,8 +26,6 @@ import com.google.common.collect.ImmutableList;
import com.squareup.okhttp.ConnectionSpec;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.TlsVersion;
import javax.inject.Inject;
import javax.inject.Singleton;
@Singleton
public class DockerOkHttpClientSupplier implements OkHttpClientSupplier {
@ -39,10 +40,10 @@ public class DockerOkHttpClientSupplier implements OkHttpClientSupplier {
@Override
public OkHttpClient get() {
OkHttpClient client = new OkHttpClient();
ConnectionSpec connectionSpecs = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
ConnectionSpec modernTLS = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
.tlsVersions(TlsVersion.TLS_1_0, TlsVersion.TLS_1_1, TlsVersion.TLS_1_2)
.build();
client.setConnectionSpecs(ImmutableList.of(connectionSpecs));
client.setConnectionSpecs(ImmutableList.of(modernTLS, ConnectionSpec.CLEARTEXT));
client.setSslSocketFactory(sslContextWithKeysSupplier.get().getSocketFactory());
return client;
}

View File

@ -16,41 +16,32 @@
*/
package org.jclouds.docker.features;
import org.jclouds.docker.compute.BaseDockerApiLiveTest;
import org.jclouds.docker.options.BuildOptions;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import org.jclouds.docker.compute.BaseDockerApiLiveTest;
import org.jclouds.docker.options.BuildOptions;
import org.testng.annotations.Test;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
@Test(groups = "live", testName = "MiscApiLiveTest", singleThreaded = true)
public class MiscApiLiveTest extends BaseDockerApiLiveTest {
private static final String API_VERSION = "1.16";
private static final String VERSION = "1.4.1";
private static final String GIT_COMMIT = "5bc2ff8";
private static final String GO_VERSION = "go1.3.3";
private static final String KERNEL_VERSION = "3.16.7-tinycore64";
private static final String ARCH = "amd64";
private static final String OS = "linux";
private static String imageId;
@Test
public void testVersion() {
assertEquals(api().getVersion().apiVersion(), API_VERSION);
assertEquals(api().getVersion().version(), VERSION);
assertEquals(api().getVersion().gitCommit(), GIT_COMMIT);
assertEquals(api().getVersion().goVersion(), GO_VERSION);
assertEquals(api().getVersion().kernelVersion(), KERNEL_VERSION);
assertEquals(api().getVersion().arch(), ARCH);
assertEquals(api().getVersion().os(), OS);
assertNotNull(api().getVersion().apiVersion());
assertNotNull(api().getVersion().version());
assertNotNull(api().getVersion().gitCommit());
assertNotNull(api().getVersion().goVersion());
assertNotNull(api().getVersion().kernelVersion());
assertNotNull(api().getVersion().arch());
assertNotNull(api().getVersion().os());
}
@Test