Code example for URI

Methods: getHostgetPortgetScheme

0
 
		connected = false;
	} 
 
	private Socket createSocket() throws WebSocketException {
		String scheme = url.getScheme();
		String host = url.getHost();
		int port = url.getPort();
 
		Socket socket = null;
 
		if (scheme != null && scheme.equals("ws")) {
			if (port == -1) {
				port = 80;
			} 
			try { 
				socket = new Socket(host, port);
				socket.setKeepAlive(true);
				socket.setSoTimeout(0);
			} catch (UnknownHostException uhe) {