I have a simple app that uses volley like this:
StringRequest stringRequest = new StringRequest(Request.Method.POST, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d("VolleyController", "Received volley response: " + response);
callback.onCallback(OperationOutcome.SUCCESS, response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// This is null.
NetworkResponse response = error.networkResponse;
Log.e("VolleyManager", "Received error response from volley: ", error );
callback.onCallback(OperationOutcome.FAILURE, null);
}
});
// Add the request to the RequestQueue.
queue.add(stringRequest);
This is the exception I get:
Received error response from volley: com.android.volley.NoConnectionError: java.io.EOFException
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:151)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
Caused by: java.io.EOFException
at com.android.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:98)
at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:202)
at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:119)
at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:798)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:405)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:349)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:517)
at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:110)
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:96)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
I've found some other answers about this online but they didn't solve it. The request is not getting to the server.
Thank you very much.
EDIT
I have both the permission on the manifest:
<uses-permission android:name="android.permission.INTERNET" />
and Internet is working fine on the device.