HopImpl(String hop) throws IllegalArgumentException { if (hop == null) throw new IllegalArgumentException("Null arg!");  StringTokenizer stringTokenizer = new StringTokenizer(hop + "/"); String hostPort = stringTokenizer.nextToken("/").trim(); transport = stringTokenizer.nextToken().trim();  if (transport == null) transport = "UDP"; else if (transport == "") transport = "UDP"; if (transport.compareToIgnoreCase("UDP") != 0 && transport.compareToIgnoreCase("TLS") != 0 && transport.compareToIgnoreCase("TCP") != 0) { System.out.println("Bad transport string " + transport); throw new IllegalArgumentException(hop); }
public HopImpl(String hostName, int portNumber, String trans) { host = hostName;
	HopImpl(String hop) throws IllegalArgumentException {		if (hop == null)			throw new IllegalArgumentException("Null arg!");		// System.out.println("hop = " + hop);		StringTokenizer stringTokenizer = new StringTokenizer(hop + "/");		String hostPort = stringTokenizer.nextToken("/").trim();		transport = stringTokenizer.nextToken().trim();		// System.out.println("Hop: transport = " + transport);		if (transport == null)			transport = "UDP";		else if (transport == "")			transport = "UDP";		if (transport.compareToIgnoreCase("UDP") != 0			&& transport.compareToIgnoreCase("TLS") != 0 // Added by Daniel J. Martinez Manzano <dani@dif.um.es>			&& transport.compareToIgnoreCase("TCP") != 0) {			System.out.println("Bad transport string " + transport);			throw new IllegalArgumentException(hop);		}		String portString = null;		//IPv6 hostport		if (hostPort.charAt(0) == '[') {			int rightSqBrackIndex = hostPort.indexOf(']');			if (rightSqBrackIndex == -1)				throw new IllegalArgumentException("Bad IPv6 reference spec");			host = hostPort.substring(0, rightSqBrackIndex + 1);			int portColon = hostPort.indexOf(':', rightSqBrackIndex);			if (portColon != -1)				try {					portString = hostPort.substring(portColon + 1).trim();				} catch (IndexOutOfBoundsException exc) {					//Do nothing - handled later				}		}		//IPv6 address and no port		else if (hostPort.indexOf(':') != hostPort.lastIndexOf(":")) {			host = '[' + hostPort + ']';		} else //no square brackets and a single or zero colons => IPv4 hostPort			{			int portColon = hostPort.indexOf(':');			if (portColon == -1)				host = hostPort;			else {				host = hostPort.substring(0, portColon).trim();				try {					portString = hostPort.substring(portColon + 1).trim();				} catch (IndexOutOfBoundsException exc) {					//Do nothing - handled later				}			}		}		if (host == null || host.equals(""))			throw new IllegalArgumentException("no host!");		if (portString == null || portString.equals("")) {			port = 5060;		} else {			try {				port = Integer.parseInt(portString);			} catch (NumberFormatException ex) {				throw new IllegalArgumentException("Bad port spec");			}		}	}