DockerModuleHandle implements ModuleHandle { static String setupDockerAddress(StringBuilder socketAddress, String u) { if (u.startsWith("tcp: u = "http: } else if (u.startsWith("unix: socketAddress.append(u.substring(7)); u = "http: } while (u.endsWith("/")) { u = u.substring(0, u.length() - 1); } return u + "/" + DEFAULT_DOCKER_VERSION; } DockerModuleHandle(Vertx vertx, LaunchDescriptor desc,
                     String id, Ports ports, String containerHost, int port, JsonObject config,
                     Logger logger);   DockerModuleHandle(Vertx vertx, LaunchDescriptor desc,
      String id, Ports ports, String containerHost, int port, JsonObject config); @Override Future<Void> start(); @Override Future<Void> stop();  }
@Test public void testDomainSocketAddresses() { StringBuilder s = new StringBuilder(); String u = DockerModuleHandle.setupDockerAddress(s, "unix: Assert.assertEquals("http: Assert.assertEquals("socket", s.toString()); s = new StringBuilder(); u = DockerModuleHandle.setupDockerAddress(s, DockerModuleHandle.DEFAULT_DOCKER_URL); Assert.assertEquals("http: Assert.assertEquals("/var/run/docker.sock", s.toString()); }
@Test public void testHostPortAddresses() { StringBuilder s = new StringBuilder(); String u = DockerModuleHandle.setupDockerAddress(s, "tcp: Assert.assertEquals("http: Assert.assertEquals("", s.toString()); s = new StringBuilder(); u = DockerModuleHandle.setupDockerAddress(s, "https: Assert.assertEquals("https: Assert.assertEquals("", s.toString()); s = new StringBuilder(); u = DockerModuleHandle.setupDockerAddress(s, "https: Assert.assertEquals("https: Assert.assertEquals("", s.toString()); }