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 ; } if ( this . executors == null ) { this . executors = new ExecutorFilter ( 1 ) ; } this . connector = new NioSocketConnector ( ) ; this . connector . getSessionConfig ( ) . setWriterIdleTime ( SolverWorldModelInterface . TIMEOUT_PERIOD / 2 ) ; this . connector . getSessionConfig ( ) . setReaderIdleTime ( ( int ) Math . ceil ( TIMEOUT_PERIOD * 1.1 ) ) ; if ( ! this . connector . getFilterChain ( ) . contains ( WorldModelSolverProtocolCodecFactory . CODEC_NAME ) ) { this . connector . getFilterChain ( ) . addLast ( WorldModelSolverProtocolCodecFactory . CODEC_NAME , new ProtocolCodecFilter ( new WorldModelSolverProtocolCodecFactory ( true ) ) ) ; } this . connector . getFilterChain ( ) . addLast ( "ExecutorPool" , this . executors ) ; this . connector . setHandler ( this . ioHandler ) ; log . debug ( "Connector set up successful." ) ; return true ; }
Sets the MINA connector and establishes the connection to the world model . Adds protocol filters .