connector = new NioSocketConnector();
// Set connect timeout for 30 seconds.
connector.setConnectTimeoutMillis(30*1000L);
connector.getFilterChain().addLast( "protocol", new ProtocolCodecFilter(new CodecFactory()) );
// Start communication.
connector.setHandler(new ProtocolHandler());
}