I had the same problem using OKHttp3
. The problem was that I didn’t close the connection for each request and for the client the same connection was available and for the server not, for this reason the server returns a error.
The solution is indicating to each request to close the connection when it is finished. You have to add a flag in the header to indicate this. In OKHttp3
is like this:
Request request = new Request.Builder()
.url(URL)
.header("Connection", "close")
...