public static int getPort ( String uriString ) { try { return ( new URI ( uriString ) ) . getPort ( ) ; } catch ( URISyntaxException e ) { try { return ( new NetworkInterfaceURI ( uriString ) ) . getPort ( ) ; } catch ( IllegalArgumentException ne ) { throw new IllegalArgumentException ( ne . getMessage ( ) , ne ) ; } } }
Helper method for retrieving port