private JsonObject grabResponse(HttpURLConnection connection)
			throws IOException, JsonParseException {
		InputStream in;
		if (lastRequestSuccessful()) {
			in = connection.getInputStream();
		}
		else {
			in = connection.getErrorStream();
		}
		if (in == null) {
			// Connection error occurred
			throw new IOException(connection.getResponseMessage());
		}
		Reader reader = new InputStreamReader(in);
		JsonObject jsonObject = JsonParser.parseReader(reader).getAsJsonObject();
		return jsonObject;
	}
Assuming the writer has been closed and connection.getResponseCode() is called
placing the value in lastResponseCode, read the response and parse into a JsonObject
@return the JsonObject
@throws IOException for problems with the socket
@throws JsonParseException for JSON parse errors
Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticConnection.java