int getPort ( ) { LOGGER . entering ( ) ; int val = - 1 ; InstanceType type = getType ( ) ; if ( commands . contains ( PORT_ARG ) ) { val = Integer . parseInt ( commands . get ( commands . indexOf ( PORT_ARG ) + 1 ) ) ; LOGGER . exiting ( val ) ; return val ; } try { if ( type . equals ( InstanceType . SELENIUM_NODE ) || type . equals ( InstanceType . SELENIUM_HUB ) ) { val = getSeleniumConfigAsJsonObject ( ) . get ( "port" ) . getAsInt ( ) ; } } catch ( JsonParseException | NullPointerException e ) { // ignore } // last ditch effort val = ( val != - 1 ) ? val : 4444 ; LOGGER . exiting ( val ) ; return val ; }
Get the port for the instance represented by this launcher