Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getting connection time out using httpsconnection  RSS feed

 
Eshwin Sukhdeve
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



I am getting the connection time out error in below line :-


System.out.println("response code"+httpConnection.getResponseMessage());

Note:-I need to pass user id and pwd in header parameter.
and I am using https connection.
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags. I've added them for you this time. You've been around here long enough that you should know how to use them by now. Code that is difficult to read just discourages people from helping you.
 
Eshwin Sukhdeve
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok
 
Mahendran Mookkiah
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eshwin,

Try setting httpConnection.setAllowUserInteraction(false);

First check the http response code using httpConnection.getResponseCode() before trying to access the message.
In case of failure response, you have to read the response from httpConnection.getErrorStream().

- Mahendran.

 
Eshwin Sukhdeve
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Mahendran,

Thanks for response ,I resolved the connection time out issue. but now I am getting the "Authentication failure" exception

{"responseCode":"100","responseMsg":"Authentication failure."}



can you or any one help me out this.
 
Anjaneya Reddy
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,


Can you please try with this below code.

System.setProperty("jsse.enableSNIExtension", "false");
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());

Thanks.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!