title: Cancelling ongoing connectoin attempt in netty
body: <p><code>Bootstrap#connect()</code> returns a <code>CahnnelFuture</code> that eventually becomes un-cancellable. How do I cancel the ongoing connection attempt?</p>
  <p>Code snippet for reference (kotlin):</p>
  <pre class="lang-kotlin prettyprint-override"><code>    val f = Bootstrap()
              .group(NioEventLoopGroup(1))
              .channel(NioSocketChannel::class.java)
              .handler(object : ChannelInitializer&lt;SocketChannel&gt;() {
                  override fun initChannel(ch: SocketChannel?) {
                  }
              })
              .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10_000)
              .connect(InetSocketAddress(&quot;10.255.255.1&quot;, 80))
      f.addListener(ChannelFutureListener {
          println(&quot;success: ${it.isSuccess}&quot;)
      })
      val th = Thread {
          Thread.sleep(500)
          println(&quot;cancellable: ${f.isCancellable}&quot;)
          f.cancel(true)
      }.also { it.start() }
      f.sync()
      th.join()
  </code></pre>