### Question:
Bootstrap extends AbstractBootstrap<Bootstrap, Channel> { public ChannelFuture connect() { validate(); SocketAddress remoteAddress = this.remoteAddress; if (remoteAddress == null) { throw new IllegalStateException("remoteAddress not set"); } return doConnect(remoteAddress, localAddress()); } Bootstrap(); private  Bootstrap(Bootstrap bootstrap); Bootstrap remoteAddress(SocketAddress remoteAddress); Bootstrap remoteAddress(String inetHost, int inetPort); Bootstrap remoteAddress(InetAddress inetHost, int inetPort); ChannelFuture connect(); ChannelFuture connect(String inetHost, int inetPort); ChannelFuture connect(InetAddress inetHost, int inetPort); ChannelFuture connect(SocketAddress remoteAddress); ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress); @Override Bootstrap validate(); @Override @SuppressWarnings("CloneDoesntCallSuperClone") Bootstrap clone(); @Override String toString();  }### Answer:
@Test(timeout = 10000) public void testConnectDeadLock() throws Exception { EventLoopGroup groupA = new LocalEventLoopGroup(1); EventLoopGroup groupB = new LocalEventLoopGroup(1); try { ChannelInboundHandler dummyHandler = new DummyHandler(); final Bootstrap bootstrapA = new Bootstrap(); bootstrapA.group(groupA); bootstrapA.channel(LocalChannel.class); bootstrapA.handler(dummyHandler); final Bootstrap bootstrapB = new Bootstrap(); bootstrapB.group(groupB); bootstrapB.channel(LocalChannel.class); bootstrapB.handler(dummyHandler); List<Future<?>> bindFutures = new ArrayList<Future<?>>(); for (int i = 0; i < 1024; i ++) { bindFutures.add(groupA.next().submit(new Runnable() { @Override public void run() { bootstrapB.connect(LocalAddress.ANY); } })); bindFutures.add(groupB.next().submit(new Runnable() { @Override public void run() { bootstrapA.connect(LocalAddress.ANY); } })); } for (Future<?> f: bindFutures) { f.sync(); } } finally { groupA.shutdownGracefully(); groupB.shutdownGracefully(); groupA.terminationFuture().sync(); groupB.terminationFuture().sync(); } }