docs: private void writeRequest(String methodName, Object arguments, HttpRequest httpRequest) throws IOException {
  		
  		ObjectNode request = mapper.createObjectNode();
  		request.put(ID, nextId.getAndIncrement());
  		request.put(JSONRPC, JsonRpcBasicServer.VERSION);
  		request.put(METHOD, methodName);
  		
  		if (arguments != null && arguments.getClass().isArray()) {
  			Object[] args = Object[].class.cast(arguments);
  			if (args.length > 0) {
  				request.set(PARAMS, mapper.valueToTree(Object[].class.cast(arguments)));
  			}
  		} else if (arguments != null && Collection.class.isInstance(arguments)) {
  			if (!Collection.class.cast(arguments).isEmpty()) {
  				request.set(PARAMS, mapper.valueToTree(arguments));
  			}
  		} else if (arguments != null && Map.class.isInstance(arguments)) {
  			if (!Map.class.cast(arguments).isEmpty()) {
  				request.set(PARAMS, mapper.valueToTree(arguments));
  			}
  		} else if (arguments != null) {
  			request.set(PARAMS, mapper.valueToTree(arguments));
  		}
  		
  		logger.debug("JSON-PRC Request: {}", request);
  		
  		ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(512);
  		mapper.writeValue(byteArrayOutputStream, request);
  		HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest) httpRequest;
  		
  		HttpEntity entity;
  		if (entityRequest.getFirstHeader("Content-Type") == null) {
  			entity = new ByteArrayEntity(byteArrayOutputStream.toByteArray(), ContentType.APPLICATION_JSON);
  		} else {
  			entity = new ByteArrayEntity(byteArrayOutputStream.toByteArray());
  		}
  		entityRequest.setEntity(entity);
  	}