Android. Volley. java.io.IOException: unexpected end of stream on Connection. How to fix?

Please help me to correct the error:
com.android.volley.NoConnectionError: java.io.IOException: unexpected end of stream on Connection{192.168.0.102:3000, proxy=DIRECT@ hostAddress=192.168.0.102 cipherSuite=none protocol=http/1.1} (recycle count=0)

Here is the code sending the request:
private void loadMyInventory() {
 RequestQueue requestQueue = Volley.newRequestQueue(this);
 String url = "http://192.168.0.102:3000/api/loadMyInventory";
 JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null,
 new Response.Listener<jsonobject>() {
@Override
 public void onResponse(JSONObject response) {
 Toast.makeText(DepositeActivity.the this response.toString(), Toast.LENGTH_LONG).show();
}
 }, new Response.ErrorListener() {
@Override
 public void onErrorResponse(VolleyError error) {
 Log.d(TAG, "onErrorResponse:" + error.toString());
}
 }) {
@Override
 public Map<string, string> getHeaders() throws AuthFailureError {
 Map<string, string> headers = new HashMap<>();
 headers.put("Steam Auth", getEncodedCredentials());
 return headers;
}
};
requestQueue.add(request);
 }</string></string></jsonobject>

This error occurs only when adding headers to the request. Tried to send the query is not using the app - everything is fine.
PS Server Node.js maybe there should be something to fix?
July 9th 19 at 10:28
1 answer
July 9th 19 at 10:30
Solution
Pretty silly of me: in the method getEncodedCredentials encoded string in base64 and I had mistakenly set the flag Base64.DEFAULT is Base64.NO_WRAP, so I got a string with hyphens.
private String getEncodedCredentials() {
 String result = Base64.encodeToString(credentials.toString().getBytes(), Base64.NO_WRAP);
 Log.d(TAG, "getEncodedCredentials:" + result);
 return result;
 }

Find more questions by tags Android