Java Httpurlconnection

Somshekar C Kadam somkadam76 at gmail.com
Wed Aug 21 07:44:08 UTC 2019


Thanks David for reply, and yes its the same environment no change at all.

Regards
Somshekar C Kadam
9036660538


On Wed, Aug 21, 2019 at 12:47 PM David Holmes <david.holmes at oracle.com>
wrote:

> Hi,
>
> Under the assumption that this question might actually involve a
> behavioural difference across different platform implementations of the
> JDK, I'd suggest asking it on the net-dev at openjdk.java.net mailing list.
>
> But be sure the ARM system and Intel system are being compared under the
> same conditions, they have to be on the same network with the same (or
> near enough same) OS and with the same network configuration. A 10s
> delay is very often a DNS timeout.
>
> Cheers,
> David
>
> On 21/08/2019 4:58 pm, Somshekar C Kadam wrote:
> > Hi All,
> > Even if I try this simple httpsurlconnection java program to print
> content
> > it takes more than 10 seconds on ARM not in intel. Not sure why please
> help
> >
> > HttpsClient.java
> > ========================
> > import java.net.MalformedURLException;
> > import java.net.URL;
> > import java.security.cert.Certificate;
> > import java.io.*;
> >
> > import javax.net.ssl.HttpsURLConnection;
> > import javax.net.ssl.SSLPeerUnverifiedException;
> >
> > public class HttpsClient {
> >
> >     public static void main(String[] args)
> >     {
> >          new HttpsClient().testIt();
> >     }
> >
> >     private void testIt(){
> >
> >        //String https_url = "https://www.google.com/";
> >        String https_url = "
> > https://transparencyreport.google.com/https/overview?hl=en";
> >        URL url;
> >        try {
> >
> >      url = new URL(https_url);
> >      HttpsURLConnection con = (HttpsURLConnection)url.openConnection();
> >
> >      //dumpl all cert info
> >      print_https_cert(con);
> >
> >      //dump all the content
> >      print_content(con);
> >
> >        } catch (MalformedURLException e) {
> >      e.printStackTrace();
> >        } catch (IOException e) {
> >      e.printStackTrace();
> >        }
> >
> >     }
> >
> >     private void print_https_cert(HttpsURLConnection con){
> >
> >      if(con!=null){
> >
> >        try {
> >
> > System.out.println("Response Code : " + con.getResponseCode());
> > System.out.println("Cipher Suite : " + con.getCipherSuite());
> > System.out.println("\n");
> >
> > Certificate[] certs = con.getServerCertificates();
> > for(Certificate cert : certs){
> >    System.out.println("Cert Type : " + cert.getType());
> >    System.out.println("Cert Hash Code : " + cert.hashCode());
> >    System.out.println("Cert Public Key Algorithm : "
> >                                      +
> cert.getPublicKey().getAlgorithm());
> >    System.out.println("Cert Public Key Format : "
> >                                      + cert.getPublicKey().getFormat());
> >    System.out.println("\n");
> > }
> >
> > } catch (SSLPeerUnverifiedException e) {
> > e.printStackTrace();
> > } catch (IOException e){
> > e.printStackTrace();
> > }
> >
> >       }
> >
> >     }
> >
> >     private void print_content(HttpsURLConnection con){
> > if(con!=null){
> >
> > try {
> >
> >    System.out.println("****** Content of the URL ********");
> >    BufferedReader br =
> > new BufferedReader(
> > new InputStreamReader(con.getInputStream()));
> >
> >    String input;
> >
> >    while ((input = br.readLine()) != null){
> >       System.out.println(input);
> >    }
> >    br.close();
> >
> > } catch (IOException e) {
> >    e.printStackTrace();
> > }
> >
> >         }
> >
> >     }
> >
> > }
> >
> >
> >
> > ======================
> > Regards
> > Somshekar C Kadam
> > 9036660538
> >
> >
> > On Tue, Aug 20, 2019 at 8:32 PM Somshekar C Kadam <somkadam76 at gmail.com>
> > wrote:
> >
> >> SOrry forgot to mention
> >>
> >> This is being tested on Armv7 board, we see the delay.
> >> But when I run this in intel machine its just takes max 1 to 2 seconds
> >> using sam java program.
> >> So stuck on this.
> >>
> >> Regards
> >> Somshekar C Kadam
> >> 9036660538
> >>
> >>
> >> On Tue, Aug 20, 2019 at 8:30 PM Somshekar C Kadam <somkadam76 at gmail.com
> >
> >> wrote:
> >>
> >>> Hi Team,
> >>>
> >>> I am newbie to Java.
> >>> we have on our environment
> >>> Linux kernel 4.9, java 1.8 version using tls 1.2 default
> >>>
> >>>
> >>>     1. using curl when we give any https link , it returns within 2
> >>>     seconds
> >>>     2. using java program using httpurlconnection class we get 10
> seconds
> >>>     or more delay.
> >>>     3. Even removed some ciphers thought it may take sometime but that
> is
> >>>     not the case.
> >>>     4. Trying an alternative to httpurlconnection class apache
> >>>     httpclient, having issues compiling and running it, any pointers
> will help.
> >>>     5. Also any pointers or suggestion why we have 10 seconds delay on
> >>>     https connection ?
> >>>     6. I have tested using oracle java 8 also, same result, also tried
> >>>     zulu11 version of java same delay.
> >>>     7. Any suggestions would help here thanks in advance
> >>>
> >>> regards
> >>> Somshekar
> >>> Regards
> >>> Somshekar C Kadam
> >>> 9036660538
> >>>
> >>
>


More information about the jdk-dev mailing list