private CommandResponse doPost(String jsonObject, HttpURLConnection connection, Class<?> responseType){
		CommandResponse result = null;
		int responseCode;
		String responseMessage = "";
		Map<String, List<String>> responseHeaders;
		try { 
			connection.setRequestMethod("POST");
			connection.setDoInput(true); 
			connection.setDoOutput(true); 
			connection.connect(); 
						
			OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
			writer.write(jsonObject); 
			writer.flush();
			writer.close();

			responseCode = connection.getResponseCode();
			
			BufferedReader in;
			boolean errorCode = false;
			if(responseCode == 400){
				in = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
				errorCode = true;
			}
			else {
				in = new BufferedReader(new InputStreamReader(connection.getInputStream()));		
			}
			String inputLine;
			StringBuffer responseJson = new StringBuffer();
			while ((inputLine = in.readLine()) != null) {
				responseJson.append(inputLine);
			}
			in.close();	
			
			//Object javaObject = jsonTrans.translateTo(responseJson.toString()); //send over the buffered reader result ,"result1"
			Object javaObject = null;
			System.out.println(responseJson.toString());
			if(!errorCode && responseType != null) {
				javaObject = jsonTrans.translateFrom(responseJson.toString(), responseType);
				responseMessage = connection.getResponseMessage();
			}
			else {
				responseMessage = responseJson.toString();
			}
			responseHeaders = connection.getHeaderFields();
			result = new CommandResponse(responseHeaders, responseCode, javaObject, responseMessage);
			
		}
		catch (IOException e) { // IO ERROR
			System.err.print("Unable to doPost\n");
			e.printStackTrace();
		}
		return result;
	}