System.out.println(Main.class.getName() + " <hostname> <port>");
return;
}
// Create TCP/IP connector.
NioSocketConnector connector = new NioSocketConnector();
// Set connect timeout.
connector.setConnectTimeout(30);
// Start communication.
connector.setHandler(new NetCatProtocolHandler());
ConnectFuture cf = connector.connect(
new InetSocketAddress(args[0], Integer.parseInt(args[1])));
// Wait for the connection attempt to be finished.
cf.awaitUninterruptibly();
cf.getSession().getCloseFuture().awaitUninterruptibly();
connector.dispose();
}