	public synchronized CaspReturn runCmd(CaspCmd cmd) throws IOException {
		open(); 
		out.println(new String(cmd.getCmdString().getBytes("UTF-8"))); 
		long requestTime = new Date().getTime();
		String line = in.readLine();
		Matcher myMatcher = Pattern.compile("^\\d+").matcher(line);
		myMatcher.find();
		int status = Integer.parseInt(line.substring(myMatcher.start(), myMatcher.end()));
		Pattern endSequence = null;
		String response = null;
		Boolean getResponse = true;
		int charsRemove = 0;
		if (status == 200) { 
			endSequence = Pattern.compile("\\r\\n\\r\\n$");
			charsRemove = 4;
		}
		else if (status == 201) { 
			endSequence = Pattern.compile("\\r\\n$");
			charsRemove = 2;
			response = in.readLine();
		}
		else {
			getResponse = false;
		}
		if (getResponse) {
			response = "";
			while(true) {
				char character = (char) in.read();
				response += character;
				if (endSequence.matcher(response).find()) { 
					break;
				}		
			}
			response = response.substring(0, response.length()-charsRemove);
		}
		return new CaspReturn(status, response, requestTime);
	}

	public synchronized CaspReturn runCmd(CaspCmd cmd) throws IOException {
		open(); 
		out.println(new String(cmd.getCmdString().getBytes("UTF-8"))); 
		long requestTime = new Date().getTime();
		String line = in.readLine();
		Matcher myMatcher = Pattern.compile("^\\d+").matcher(line);
		myMatcher.find();
		int status = Integer.parseInt(line.substring(myMatcher.start(), myMatcher.end()));
		Pattern endSequence = null;
		String response = null;
		Boolean getResponse = true;
		int charsRemove = 0;
		if (status == 200) { 
			endSequence = Pattern.compile("\\r\\n\\r\\n$");
			charsRemove = 4;
		}
		else if (status == 201) { 
			endSequence = Pattern.compile("\\r\\n$");
			charsRemove = 2;
		}
		else {
			getResponse = false;
		}
		if (getResponse) {
			response = "";
			while(true) {
				char character = (char) in.read();
				response += character;
				if (endSequence.matcher(response).find()) { 
					break;
				}		
			}
			response = response.substring(0, response.length()-charsRemove);
		}
		return new CaspReturn(status, response, requestTime);
	}
