@Override
    public void run(){
	while(true){
	    try {
		JSONObject o = read();
		if(o == null){
		    throw new IOException("Graphics disconnected");
		}
		connection.input(o);
	    }
	    catch (IOException e){
		Debug.error("GUI disconnected, exiting!");
	    }
	    catch (ProtocolException e){
		try {
		    JSONObject errorMessage = new JSONObject().put("error", e.getMessage());
		    connection.sendMessage(errorMessage);
		}
		catch (JSONException f){}
		catch (IOException g){
		}
	    }
	}
    }