Using java class HttpsURLConnection

前端 未结 9 1441
孤独总比滥情好
孤独总比滥情好 2020-12-14 00:41

I have a small piece of code which basically impements a HTTP-Client, i.e. it POSTS request and works with re RESPONSE. As long as HTTP is concenerned everthing work well. F

9条回答
  •  伪装坚强ぢ
    2020-12-14 01:16

    In my case, the protocol and port were not correct while invoking the httpsUrlConnection.

    Port and protocol were defined as static class variables. And the step prior to the failed step, was invoking an httpUrlConnection. That method changed the port/protocol to 80/http, but didn't set it back to /https at the end. So eventhough httpsUrlConnection was invoked, it was still using http/80. Once I reset those at the end of the httpUrlConnection method, the error disappeared.

提交回复
热议问题