private Result getResult(HttpURLConnection connection) {
		BufferedReader in = null;
		Printer.printWithTime(TAG, "receiving inputstream");
		try {
			// get result stream from connection
			in = new BufferedReader(new InputStreamReader(
					connection.getInputStream()));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
//		Scanner s;
//		try {
//			if (connection.getResponseCode() != 200) {
//			    s = new Scanner(connection.getErrorStream());
//			} else {
//			    s = new Scanner(connection.getInputStream());
//			}
//
//		s.useDelimiter("\\Z");
//		String response = s.next();
//		System.out.println(response);
//		} catch (IOException e1) {
//			// TODO Auto-generated catch block
//			e1.printStackTrace();
//		}
		String decodedString = "";
		String resultJSON = null;
		Printer.printWithTime(TAG, "decoding string");
		try {
			// get JSON result
			while ((decodedString = in.readLine()) != null) {
				Printer.printWithTime(TAG, decodedString);
				resultJSON = decodedString;
				if(resultJSON.equals("{\"result\":[]}"))
					continue;
				Result result = new Result();
				if(resultJSON.contains("final\":true"))
					result.setFinal();
				
				while (resultJSON.indexOf("transcript") != -1) {
					
					resultJSON = resultJSON
							.substring(resultJSON.indexOf("transcript") + 13);
					String utterance;
					// clean from special chars
					utterance = resultJSON.substring(0, resultJSON.indexOf("\""));
					utterance = utterance.replace("@", "");

					utterance = utterance.replaceAll("[^a-zA-Z 0-9]", "");
					utterance = utterance.replaceAll(" +", " ");

					if (!utterance.equals(""))
						if (utterance.charAt(0) == ' ')
							utterance = utterance.substring(1);

					// add to resultT
					if (!utterance.equals(""))
						result.addResult(utterance);

				}
				resultQueue.add(result);
				//result.printShort();
			}
			Result r = new Result();
			r.setEndSignal();
			resultQueue.add(r);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}



		// return result
		return null;

	}