private boolean parseHandshake(JSONObject o) throws ProtocolException {
	try {
	    if(!(o.get("message").equals("connect"))){
		throw new ProtocolException("Expected 'connect' handshake, but got '"
					    + o.get("message") + "' key");
	    }
	    if(!(o.getInt("revision") == 1)){
		throw new ProtocolException("Wrong protocol revision: supporting 1, but got " +
					    o.getInt("revision"));
	    }
	    if(!o.getString("password").equals(password)){
		Debug.warn("GUI sent wrong password");
		throw new ProtocolException("Wrong password!");
	    }
	    Debug.debug("Correct password");
	    gotHandshake = true;
	    container.set(this);
	    try {
		if(!o.getString("laserstyle").equals("start-stop")){
		    alternativeLaserStyle = true;
		}
	    }
	    catch(JSONException e){}
	    return true;
	}
	catch (JSONException e){
	    throw new ProtocolException("Invalid or incomplete packet: " + e.getMessage());
	}
    }