protected boolean setConnector ( ) { if ( this . host == null ) { log . error ( "No host value set, cannot set up socket connector." ) ; return false ; } if ( this . port < 0 || this . port > 65535 ) { log . error ( "Port value is invalid {}." , Integer . valueOf ( this . port ) ) ; return false ; } // Disconnect if already connected if ( this . connector != null ) { boolean tmp = this . stayConnected ; this . stayConnected = false ; this . _disconnect ( ) ; this . stayConnected = tmp ; } this . executors = new ExecutorFilter ( 1 ) ; this . connector = new NioSocketConnector ( ) ; this . connector . getSessionConfig ( ) . setTcpNoDelay ( true ) ; if ( ! this . connector . getFilterChain ( ) . contains ( AggregatorSensorProtocolCodecFactory . CODEC_NAME ) ) { this . connector . getFilterChain ( ) . addLast ( AggregatorSensorProtocolCodecFactory . CODEC_NAME , new ProtocolCodecFilter ( new AggregatorSensorProtocolCodecFactory ( false ) ) ) ; } this . connector . getFilterChain ( ) . addLast ( "ExecutorPool" , this . executors ) ; this . connector . setHandler ( this . ioHandler ) ; log . debug ( "Connector set up successfully." ) ; return true ; }
Configures the IO connector to establish a connection to the aggregator .