Code example for URI

Methods: getHost, getPath

0
	} 
	 
	 
	public byte[] getHandshake() 
	{ 
		String path = url.getPath();
		String host = url.getHost();
		origin = "http://" + host;
		 
		String handshake = "GET " + path + " HTTP/1.1\r\n" +
				"Host: " + host + "\r\n" +
				"Connection: Upgrade\r\n" + 
				"Sec-WebSocket-Key2: " + key2 + "\r\n";
		 
		if (protocol != null) {
			handshake += "Sec-WebSocket-Protocol: " + protocol + "\r\n";
		} 
		 
		handshake += "Upgrade: WebSocket\r\n" +
				"Sec-WebSocket-Key1: " + key1 + "\r\n" +
				"Origin: " + origin + "\r\n" +