I get an illegal state exception when i set DoOutput to true.
public boolean sendLinksToMaster(String ipport, List links){
boolean sen
Apart from the watches as mentioned in the previous comment, it might also occur if there is something wrong with the connection. For example:
I was setting a property:post.setRequestProperty("Ocp-Apim-Subscription-Key", "<>") after writing into OutPut Stream like post.getOutputStream().write(jsonBody.getBytes("UTF-8"));
It was like:
post.getOutputStream().write(jsonBody.getBytes("UTF-8"))
post.setRequestProperty("Ocp-Apim-Subscription-Key", "<>")
In this case, I was also getting "Already Connected". To fix it I made it like:
post.setRequestProperty("Ocp-Apim-Subscription-Key", "<>")
post.getOutputStream().write(jsonBody.getBytes("UTF-8"))