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 ( ) . setIdleTime ( IdleStatus . WRITER_IDLE , ClientWorldModelInterface . TIMEOUT_PERIOD / 2 ) ; // this.connector.getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, // (int) (ClientWorldModelInterface.TIMEOUT_PERIOD * 1.1f)); if ( ! this . connector . getFilterChain ( ) . contains ( WorldModelClientProtocolCodecFactory . CODEC_NAME ) ) { this . connector . getFilterChain ( ) . addLast ( WorldModelClientProtocolCodecFactory . CODEC_NAME , new ProtocolCodecFilter ( new WorldModelClientProtocolCodecFactory ( true ) ) ) ; } this . connector . getFilterChain ( ) . addLast ( "ExecutorPool" , this . executors ) ; this . connector . setHandler ( this . ioHandler ) ; log . debug ( "Connector set up successful." ) ; return true ; }
Sets - up the connector for this MINA session .