java.net.ProtocolException: unexpected end of stream
I am facing a strange issue, and I am not able to debug it out. I have implemented a logic for uploading stream of data and am using Volley for the same, I have customized a logic little bit in HurlStack , addBodyIfExists api,so that body of type "application/octet-stream" can be handled. My logic is to post progress to user, so that UI can be updated indicating user progress in upload, below my logic for same. int toRead = length; // File length byte[] data = new byte[4096]; connection.setDoOutput(true); if(length != -1) { connection.setFixedLengthStreamingMode(length); } else { connection