+ return sendRequest(http, body);
+ }
+ private boolean send_1_14_OK() throws IOException {
+ HttpURLConnection http = NetworkUtil.prepareConnection(mProfile, "add");
+ http.setRequestMethod("PUT");
+ http.setRequestProperty("Content-Type", "application/json");
+ http.setRequestProperty("Accept", "*/*");
+
+ net.ktnx.mobileledger.json.v1_14.ParsedLedgerTransaction jsonTransaction =
+ net.ktnx.mobileledger.json.v1_14.ParsedLedgerTransaction.fromLedgerTransaction(
+ transaction);
+ ObjectMapper mapper = new ObjectMapper();
+ ObjectWriter writer =
+ mapper.writerFor(net.ktnx.mobileledger.json.v1_14.ParsedLedgerTransaction.class);
+ String body = writer.writeValueAsString(jsonTransaction);
+
+ return sendRequest(http, body);
+ }
+ private boolean sendRequest(HttpURLConnection http, String body) throws IOException {
+ if (simulate) {
+ debug("network", "The request would be: " + body);
+ try {
+ Thread.sleep(1500);
+ if (Math.random() > 0.3)
+ throw new RuntimeException("Simulated test exception");
+ }
+ catch (InterruptedException ex) {
+ Logger.debug("network", ex.toString());
+ }
+
+ return true;
+ }
+