// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String ERROR = "error";
// 
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String ID = "id";
// 
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String JSONRPC = "jsonrpc";
// 
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String METHOD = "method";
// 
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String PARAMS = "params";
// 
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String RESULT = "result";
// 
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String VERSION = "2.0";


import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.ERROR;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.ID;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.JSONRPC;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.METHOD;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.PARAMS;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.RESULT;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.VERSION;
import static com.googlecode.jsonrpc4j.Util.hasNonNullData;
		ObjectNode jsonObject = ObjectNode.class.cast(response);
		
		if (id != null) {
			while (isIdValueNotCorrect(id, jsonObject)) {
				response = context.nextValue();
				raiseExceptionIfNotValidResponseObject(response);
				jsonObject = ObjectNode.class.cast(response);
			}
		}
		return jsonObject;
	}
	
	private void notifyAnswerListener(ObjectNode jsonObject) {
		if (this.requestListener != null) {
			this.requestListener.onBeforeResponseProcessed(this, jsonObject);
		}
	}
	
	protected void handleErrorResponse(ObjectNode jsonObject) throws Throwable {
		if (hasError(jsonObject)) {
			// resolve and throw the exception
			if (exceptionResolver == null) {
				throw DefaultExceptionResolver.INSTANCE.resolveException(jsonObject);
			} else {
				throw exceptionResolver.resolveException(jsonObject);
			}
		}
	}
	
	private boolean hasResult(ObjectNode jsonObject) {
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String ERROR = "error";
// 
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String ID = "id";
// 
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String JSONRPC = "jsonrpc";
// 
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String METHOD = "method";
// 
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String PARAMS = "params";
// 
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String RESULT = "result";
// 
// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
// public static final String VERSION = "2.0";


// Path: src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.ERROR;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.ID;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.JSONRPC;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.METHOD;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.PARAMS;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.RESULT;
import static com.googlecode.jsonrpc4j.JsonRpcBasicServer.VERSION;
import static com.googlecode.jsonrpc4j.Util.hasNonNullData;

		ObjectNode jsonObject = ObjectNode.class.cast(response);
		
		if (id != null) {
			while (isIdValueNotCorrect(id, jsonObject)) {
				response = context.nextValue();
				raiseExceptionIfNotValidResponseObject(response);
				jsonObject = ObjectNode.class.cast(response);
			}
		}
		return jsonObject;
	}
	
	private void notifyAnswerListener(ObjectNode jsonObject) {
		if (this.requestListener != null) {
			this.requestListener.onBeforeResponseProcessed(this, jsonObject);
		}
	}
	
	protected void handleErrorResponse(ObjectNode jsonObject) throws Throwable {
		if (hasError(jsonObject)) {
			// resolve and throw the exception
			if (exceptionResolver == null) {
				throw DefaultExceptionResolver.INSTANCE.resolveException(jsonObject);
			} else {
				throw exceptionResolver.resolveException(jsonObject);
			}
		}
	}
	
	private boolean hasResult(ObjectNode jsonObject) {
		return hasNonNullData(jsonObject, RESULT);