I have written an app with CNO that connects to a webservice using this piece of code...
NetworkManager.getInstance().addToQueueAndWait(connReq);
Map<String,Object> result = new JSONParser().parseJSON(new InputStreamReader(new ByteArrayInputStream(connReq.getResponseData()), "UTF-8"));
return result;
The code works fine for all successful connections. However when there is a "500 Internal Server Error" all it does it display a dialog with "Cancel" and "Retry".
The problem is that I am deliberately firing a bad request at an endpoint as part of a test - but I don't seems to have any choice about how to handle a bad response.
The code gets to this line - NetworkManager.getInstance().addToQueueAndWait(connReq); - and then dies.
Is there anyway to capture a fail and then carry on?
Thanks