Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bsideup committed Feb 22, 2017
1 parent 1d31617 commit 2ba2e8b
Showing 1 changed file with 1 addition and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

import com.github.dockerjava.core.DefaultDockerClientConfig;
import com.github.dockerjava.core.DockerClientConfig;
import org.apache.commons.io.IOUtils;
import org.jetbrains.annotations.NotNull;
import org.rnorth.tcpunixsocketproxy.TcpToNamedPipeSocketProxy;

import java.io.File;
import java.net.URI;

public class NamedPipeSocketClientProviderStrategy extends DockerClientProviderStrategy {

Expand All @@ -22,24 +19,7 @@ public void test() throws InvalidConfigurationException {
throw new InvalidConfigurationException("this strategy only works with named pipe file");
}

TcpToNamedPipeSocketProxy proxy = new TcpToNamedPipeSocketProxy(NAMED_PIPE_NAME);

try {
int proxyPort = proxy.start().getPort();

System.out.println("Pinging...");
System.out.println(IOUtils.toString(URI.create("http://localhost:" + proxyPort + "/v1.25/_ping")));
System.out.println(IOUtils.toString(URI.create("http://localhost:" + proxyPort + "/v1.25/_ping")));
System.out.println(IOUtils.toString(URI.create("http://localhost:" + proxyPort + "/v1.25/_ping")));

config = tryConfiguration("tcp://localhost:" + proxyPort);

LOGGER.info("Accessing unix domain socket via TCP proxy (" + NAMED_PIPE_FILE_NAME + " via localhost:" + proxyPort + ")");
} catch (Exception e) {
proxy.stop();

throw new InvalidConfigurationException("ping failed", e);
}
config = tryConfiguration("tcp://localhost:" + 2376);
}

@Override
Expand Down

0 comments on commit 2ba2e8b

Please sign in to comment.