@Test
  public void testConnectCancellation() throws Throwable {
    // Check if the test can be executed or should be skipped because of no network/internet
    // connection
    // See https://github.com/netty/netty/issues/1474
    boolean badHostTimedOut = true;
    Socket socket = new Socket();
    try {
      socket.connect(new InetSocketAddress(BAD_HOST, BAD_PORT), 10);
    } catch (ConnectException e) {
      badHostTimedOut = false;
      // is thrown for no route to host when using Socket connect
    } catch (Exception e) {
      // ignore
    } finally {
      try {
        socket.close();
      } catch (IOException e) {
        // ignore
      }
    }

    assumeThat(
        "The connection attempt to " + BAD_HOST + " does not time out.", badHostTimedOut, is(true));

    run();
  }
 @Test(timeout = 30000)
 public void testConnectTimeout() throws Throwable {
   run();
 }