66import java .net .InetAddress ;
77import java .net .InetSocketAddress ;
88import java .net .SocketAddress ;
9- import java .nio .channels .spi .SelectorProvider ;
109import java .security .Security ;
1110
1211import javax .net .ssl .SSLEngine ;
122121import com .github .dockerjava .netty .exec .WaitContainerCmdExec ;
123122
124123import io .netty .bootstrap .Bootstrap ;
125- import io .netty .channel .ChannelFactory ;
126124import io .netty .channel .ChannelInitializer ;
127125import io .netty .channel .EventLoopGroup ;
126+ import io .netty .channel .kqueue .KQueueDomainSocketChannel ;
127+ import io .netty .channel .kqueue .KQueueEventLoopGroup ;
128128import io .netty .channel .nio .NioEventLoopGroup ;
129129import io .netty .channel .socket .DuplexChannel ;
130130import io .netty .channel .socket .SocketChannel ;
131131import io .netty .channel .socket .nio .NioSocketChannel ;
132+ import io .netty .channel .unix .DomainSocketAddress ;
132133import io .netty .handler .codec .http .HttpClientCodec ;
133134import io .netty .handler .logging .LoggingHandler ;
134135import io .netty .handler .ssl .SslHandler ;
135136import io .netty .util .concurrent .DefaultThreadFactory ;
136- import jnr .enxio .channels .NativeSelectorProvider ;
137- import jnr .unixsocket .UnixSocketAddress ;
138- import jnr .unixsocket .UnixSocketChannel ;
139137
140138/**
141139 * Experimental implementation of {@link DockerCmdExecFactory} that supports http connection hijacking that is needed to pass STDIN to the
@@ -221,24 +219,11 @@ private class UnixDomainSocketInitializer implements NettyInitializer {
221219
222220 @ Override
223221 public EventLoopGroup init (Bootstrap bootstrap , DockerClientConfig dockerClientConfig ) {
224- final SelectorProvider nativeSelectorProvider = NativeSelectorProvider .getInstance ();
225222
226- EventLoopGroup nioEventLoopGroup = new NioEventLoopGroup (0 ,
227- new DefaultThreadFactory (threadPrefix ), nativeSelectorProvider );
223+ EventLoopGroup nioEventLoopGroup = new KQueueEventLoopGroup (0 ,
224+ new DefaultThreadFactory (threadPrefix ));
228225
229- ChannelFactory <NioSocketChannel > factory = new ChannelFactory <NioSocketChannel >() {
230-
231- @ Override
232- public NioSocketChannel newChannel () {
233- try {
234- return new NioSocketChannel (UnixSocketChannel .create ());
235- } catch (IOException e ) {
236- throw new RuntimeException ();
237- }
238- }
239- };
240-
241- bootstrap .group (nioEventLoopGroup ).channelFactory (factory )
226+ bootstrap .group (nioEventLoopGroup ).channel (KQueueDomainSocketChannel .class )
242227 .handler (new ChannelInitializer <SocketChannel >() {
243228 @ Override
244229 protected void initChannel (final SocketChannel channel ) throws Exception {
@@ -257,7 +242,7 @@ public DuplexChannel connect(Bootstrap bootstrap) throws InterruptedException {
257242 throw new RuntimeException ("socket not found: " + path );
258243 }
259244
260- UnixSocketAddress address = new UnixSocketAddress (path );
245+ DomainSocketAddress address = new DomainSocketAddress (path );
261246
262247 return (DuplexChannel ) bootstrap .connect (address ).sync ().channel ();
263248 }
0 commit comments