33import static com .google .common .base .Preconditions .checkNotNull ;
44
55import java .io .IOException ;
6- import java .net .InetAddress ;
7- import java .net .InetSocketAddress ;
8- import java .net .ProtocolFamily ;
9- import java .net .SocketAddress ;
10- import java .nio .channels .DatagramChannel ;
11- import java .nio .channels .Pipe ;
12- import java .nio .channels .SelectionKey ;
13- import java .nio .channels .Selector ;
14- import java .nio .channels .ServerSocketChannel ;
15- import java .nio .channels .spi .AbstractSelectableChannel ;
16- import java .nio .channels .spi .AbstractSelector ;
176import java .nio .channels .spi .SelectorProvider ;
187import java .security .Security ;
19- import java .util .Set ;
208
219import javax .net .ssl .SSLContext ;
2210import javax .net .ssl .SSLEngine ;
144132import jnr .enxio .channels .NativeSelectorProvider ;
145133import jnr .unixsocket .UnixSocketAddress ;
146134import jnr .unixsocket .UnixSocketChannel ;
147- import unisockets .Addr ;
148135
149136/**
150137 * Experimental implementation of {@link DockerCmdExecFactory} that supports http connection hijacking that is needed to pass STDIN to the
@@ -232,8 +219,8 @@ private class UnixDomainSocketInitializer implements NettyInitializer {
232219
233220 @ Override
234221 public EventLoopGroup init (Bootstrap bootstrap , DockerClientConfig dockerClientConfig ) {
235- final SelectorProvider nativeSelectorProvider = NativeSelectorProvider .getInstance ();
236-
222+ final SelectorProvider nativeSelectorProvider = NativeSelectorProvider .getInstance ();
223+
237224 EventLoopGroup nioEventLoopGroup = new NioEventLoopGroup (0 ,
238225 new DefaultThreadFactory (threadPrefix ), nativeSelectorProvider );
239226
@@ -242,17 +229,18 @@ public EventLoopGroup init(Bootstrap bootstrap, DockerClientConfig dockerClientC
242229 @ Override
243230 public NioSocketChannel newChannel () {
244231 try {
245- return new NioSocketChannel (UnixSocketChannel .create ());
246- } catch (IOException e ) {
247- throw new RuntimeException ();
248- }
232+ return new NioSocketChannel (UnixSocketChannel .create ());
233+ } catch (IOException e ) {
234+ throw new RuntimeException ();
235+ }
249236 }
250237 };
251238
252239 bootstrap .group (nioEventLoopGroup ).channelFactory (factory )
253240 .handler (new ChannelInitializer <SocketChannel >() {
254241 @ Override
255242 protected void initChannel (final SocketChannel channel ) throws Exception {
243+ channel .pipeline ().addLast (new LoggingHandler (getClass ()));
256244 channel .pipeline ().addLast (new HttpClientCodec ());
257245 }
258246 });
@@ -263,13 +251,13 @@ protected void initChannel(final SocketChannel channel) throws Exception {
263251 @ Override
264252 public DuplexChannel connect (Bootstrap bootstrap ) throws InterruptedException {
265253
266- if (!path .exists ()) {
267- throw new RuntimeException ("socket not found: " + path );
254+ if (!path .exists ()) {
255+ throw new RuntimeException ("socket not found: " + path );
268256 }
269-
270- UnixSocketAddress socket = new UnixSocketAddress (path );
271257
272- return (DuplexChannel ) bootstrap .connect (socket ).sync ().channel ();
258+ UnixSocketAddress address = new UnixSocketAddress (path );
259+
260+ return (DuplexChannel ) bootstrap .connect (address ).sync ().channel ();
273261 }
274262 }
275263
@@ -278,9 +266,9 @@ private class InetSocketInitializer implements NettyInitializer {
278266 public EventLoopGroup init (Bootstrap bootstrap , final DockerClientConfig dockerClientConfig ) {
279267 EventLoopGroup nioEventLoopGroup = new NioEventLoopGroup (0 , new DefaultThreadFactory (threadPrefix ));
280268
281- InetAddress addr = InetAddress .getLoopbackAddress ();
269+ // InetAddress addr = InetAddress.getLoopbackAddress();
282270
283- final SocketAddress proxyAddress = new InetSocketAddress (addr , 8008 );
271+ // final SocketAddress proxyAddress = new InetSocketAddress(addr, 8008);
284272
285273 Security .addProvider (new BouncyCastleProvider ());
286274
0 commit comments