Hi Yossi, Thanks for correcting me, I used example from 4.5.9, let me know if I am setting proper jar file or need to give any other or missing any step.
source code ===================== package org.apache.http.examples.client; import java.io.File; import javax.net.ssl.SSLContext; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.TrustSelfSignedStrategy; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; /** * This example demonstrates how to create secure connections with a custom SSL * context. */ public class ClientCustomSSL { public final static void main(String[] args) throws Exception { // Trust own CA and all self-signed certs SSLContext sslcontext = SSLContexts.custom() .loadTrustMaterial(new File("my.keystore"), "nopassword".toCharArray(), new TrustSelfSignedStrategy()) .build(); // Allow TLSv1 protocol only SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( sslcontext, new String[] { "TLSv1" }, null, SSLConnectionSocketFactory.getDefaultHostnameVerifier()); CloseableHttpClient httpclient = HttpClients.custom() .setSSLSocketFactory(sslsf) .build(); try { HttpGet httpget = new HttpGet("https://httpbin.org/"); System.out.println("Executing request " + httpget.getRequestLine()); CloseableHttpResponse response = httpclient.execute(httpget); try { HttpEntity entity = response.getEntity(); System.out.println("----------------------------------------"); System.out.println(response.getStatusLine()); EntityUtils.consume(entity); } finally { response.close(); } } finally { httpclient.close(); } } } ====================================================== Compile error logs ========================= somshekar@celsys041:~$ javac -classpath /home/somshekar/akshay/java-jvms/httpcomponents-client-4.5.9/lib/httpclient-4.5.9.jar ClientCustomSSL.java ClientCustomSSL.java:33: error: cannot find symbol import org.apache.http.HttpEntity; ^ symbol: class HttpEntity location: package org.apache.http ClientCustomSSL.java:40: error: package org.apache.http.ssl does not exist import org.apache.http.ssl.SSLContexts; ^ ClientCustomSSL.java:41: error: package org.apache.http.util does not exist import org.apache.http.util.EntityUtils; ^ warning: unknown enum constant ThreadingBehavior.SAFE reason: class file for org.apache.http.annotation.ThreadingBehavior not found warning: unknown enum constant ThreadingBehavior.SAFE ClientCustomSSL.java:51: error: cannot find symbol SSLContext sslcontext = SSLContexts.custom() ^ symbol: variable SSLContexts location: class ClientCustomSSL ClientCustomSSL.java:68: error: cannot access HttpRequest System.out.println("Executing request " + httpget.getRequestLine()); ^ class file for org.apache.http.HttpRequest not found ClientCustomSSL.java:70: error: cannot access AbstractHttpMessage CloseableHttpResponse response = httpclient.execute(httpget); ^ class file for org.apache.http.message.AbstractHttpMessage not found ClientCustomSSL.java:72: error: cannot find symbol HttpEntity entity = response.getEntity(); ^ symbol: class HttpEntity location: class ClientCustomSSL ClientCustomSSL.java:72: error: cannot access HttpResponse HttpEntity entity = response.getEntity(); ^ class file for org.apache.http.HttpResponse not found ClientCustomSSL.java:75: error: cannot find symbol System.out.println(response.getStatusLine()); ^ symbol: method getStatusLine() location: variable response of type CloseableHttpResponse ClientCustomSSL.java:76: error: cannot find symbol EntityUtils.consume(entity); ^ symbol: variable EntityUtils location: class ClientCustomSSL 10 errors 2 warnings ============================================================== somshekar@celsys041:~$ thanks in advance Regards Somshekar C Kadam 9036660538 On Thu, Sep 5, 2019 at 5:06 PM <yo...@yossi.at> wrote: > The compilation error are the result of you coping code from HC version > 5.0 and using it with JARs for HC 4.5.x. The hint is in the package name > (client5). > I suggest you look for examples for the current version (4.5.x). > > > -----Original Message----- > From: Somshekar C Kadam <somkada...@gmail.com> > Sent: Thursday, 5 September 2019 14:28 > To: HttpClient User Discussion <httpclient-users@hc.apache.org> > Subject: Re: apache httpclient > > Hi Bernd, > > I am using java 1.8, Ubuntu 16.04, code is given below which I am trying > to compile which uses apache httpclient. > > httpclient jar fies downloaded > > somshekar@celsys041:~$ ls > /home/somshekar/akshay/java-jvms/httpcomponents-client-4.5.9/lib/ > commons-codec-1.11.jar httpclient-4.5.9.jar > httpclient-win-4.5.9.jar jna-4.5.2.jar commons-logging-1.2.jar > httpclient-cache-4.5.9.jar httpcore-4.4.11.jar > jna-platform-4.5.2.jar > fluent-hc-4.5.9.jar httpclient-osgi-4.5.9.jar httpmime-4.5.9.jar > > error log > ==================== > somshekar@celsys041:~$ javac -classpath > > /home/somshekar/akshay/java-jvms/httpcomponents-client-4.5.9/lib/httpcore-4.4.11.jar > ClientCustomSSL.java > ClientCustomSSL.java:9: error: package > org.apache.hc.client5.http.classic.methods does not exist import > org.apache.hc.client5.http.classic.methods.HttpGet; > ^ > ClientCustomSSL.java:10: error: package > org.apache.hc.client5.http.impl.classic does not exist import > org.apache.hc.client5.http.impl.classic.CloseableHttpClient; > ^ > ClientCustomSSL.java:11: error: package > org.apache.hc.client5.http.impl.classic does not exist import > org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; > ^ > ClientCustomSSL.java:12: error: package > org.apache.hc.client5.http.impl.classic does not exist import > org.apache.hc.client5.http.impl.classic.HttpClients; > ^ > ClientCustomSSL.java:13: error: package org.apache.hc.client5.http.impl.io > does not exist > import > org.apache.hc.client5.http.impl.io > .PoolingHttpClientConnectionManagerBuilder; > ^ > ClientCustomSSL.java:14: error: package org.apache.hc.client5.http.io > does not exist import org.apache.hc.client5.http.io > .HttpClientConnectionManager; > ^ > ClientCustomSSL.java:15: error: package org.apache.hc.client5.http.protocol > does not exist > import org.apache.hc.client5.http.protocol.HttpClientContext; > ^ > ClientCustomSSL.java:16: error: package org.apache.hc.client5.http.ssl > does not exist import > org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory; > ^ > ClientCustomSSL.java:17: error: package org.apache.hc.client5.http.ssl > does not exist import > org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder; > ^ > ClientCustomSSL.java:18: error: package org.apache.hc.core5.http.io.entity > does not exist > import org.apache.hc.core5.http.io.entity.EntityUtils; > ^ > ClientCustomSSL.java:19: error: package org.apache.hc.core5.http.ssl does > not exist import org.apache.hc.core5.http.ssl.TLS; > ^ > ClientCustomSSL.java:20: error: package org.apache.hc.core5.ssl does not > exist import org.apache.hc.core5.ssl.SSLContexts; > ^ > ClientCustomSSL.java:21: error: package org.apache.hc.core5.ssl does not > exist import org.apache.hc.core5.ssl.TrustStrategy; > ^ > ClientCustomSSL.java:32: error: cannot find symbol > .loadTrustMaterial(new TrustStrategy() { > ^ > symbol: class TrustStrategy > location: class ClientCustomSSL > ClientCustomSSL.java:34: error: method does not override or implement a > method from a supertype > @Override > ^ > ClientCustomSSL.java:31: error: cannot find symbol > final SSLContext sslcontext = SSLContexts.custom() > ^ > symbol: variable SSLContexts > location: class ClientCustomSSL > ClientCustomSSL.java:45: error: cannot find symbol > final SSLConnectionSocketFactory sslSocketFactory = > SSLConnectionSocketFactoryBuilder.create() > ^ > symbol: class SSLConnectionSocketFactory > location: class ClientCustomSSL > ClientCustomSSL.java:47: error: cannot find symbol > .setTlsVersions(TLS.V_1_2) > ^ > symbol: variable TLS > location: class ClientCustomSSL > ClientCustomSSL.java:45: error: cannot find symbol > final SSLConnectionSocketFactory sslSocketFactory = > SSLConnectionSocketFactoryBuilder.create() > ^ > symbol: variable SSLConnectionSocketFactoryBuilder > location: class ClientCustomSSL > ClientCustomSSL.java:46: error: cannot find symbol > .setSslContext(SSLContexts.createSystemDefault()) > ^ > symbol: variable SSLContexts > location: class ClientCustomSSL > ClientCustomSSL.java:49: error: cannot find symbol > final HttpClientConnectionManager cm = > PoolingHttpClientConnectionManagerBuilder.create() > ^ > symbol: class HttpClientConnectionManager > location: class ClientCustomSSL > ClientCustomSSL.java:49: error: cannot find symbol > final HttpClientConnectionManager cm = > PoolingHttpClientConnectionManagerBuilder.create() > ^ > symbol: variable PoolingHttpClientConnectionManagerBuilder > location: class ClientCustomSSL > ClientCustomSSL.java:52: error: cannot find symbol > try (CloseableHttpClient httpclient = HttpClients.custom() > ^ > symbol: class CloseableHttpClient > location: class ClientCustomSSL > ClientCustomSSL.java:52: error: cannot find symbol > try (CloseableHttpClient httpclient = HttpClients.custom() > ^ > symbol: variable HttpClients > location: class ClientCustomSSL > ClientCustomSSL.java:56: error: cannot find symbol > final HttpGet httpget = new HttpGet("https://httpbin.org/"); > ^ > symbol: class HttpGet > location: class ClientCustomSSL > ClientCustomSSL.java:56: error: cannot find symbol > final HttpGet httpget = new HttpGet("https://httpbin.org/"); > ^ > symbol: class HttpGet > location: class ClientCustomSSL > ClientCustomSSL.java:60: error: cannot find symbol > final HttpClientContext clientContext = > HttpClientContext.create(); > ^ > symbol: class HttpClientContext > location: class ClientCustomSSL > ClientCustomSSL.java:60: error: cannot find symbol > final HttpClientContext clientContext = > HttpClientContext.create(); > ^ > symbol: variable HttpClientContext > location: class ClientCustomSSL > ClientCustomSSL.java:61: error: cannot find symbol > try (CloseableHttpResponse response = > httpclient.execute(httpget, clientContext)) { > ^ > symbol: class CloseableHttpResponse > location: class ClientCustomSSL > ClientCustomSSL.java:64: error: cannot find symbol > > System.out.println(EntityUtils.toString(response.getEntity())); > ^ > symbol: variable EntityUtils > location: class ClientCustomSSL > 30 errors > ======================================================== > > > Code > =================================================== > package org.apache.hc.client5.http.examples; > > import java.security.cert.CertificateException; > import java.security.cert.X509Certificate; > > import javax.net.ssl.SSLContext; > import javax.net.ssl.SSLSession; > > import org.apache.hc.client5.http.classic.methods.HttpGet; > import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; > import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; > import org.apache.hc.client5.http.impl.classic.HttpClients; > import > org.apache.hc.client5.http.impl.io > .PoolingHttpClientConnectionManagerBuilder; > import org.apache.hc.client5.http.io.HttpClientConnectionManager; > import org.apache.hc.client5.http.protocol.HttpClientContext; > import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory; > import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder; > import org.apache.hc.core5.http.io.entity.EntityUtils; > import org.apache.hc.core5.http.ssl.TLS; import > org.apache.hc.core5.ssl.SSLContexts; > import org.apache.hc.core5.ssl.TrustStrategy; > > /** > * This example demonstrates how to create secure connections with a > custom SSL > * context. > */ > public class ClientCustomSSL { > > public final static void main(final String[] args) throws Exception { > // Trust standard CA and those trusted by our custom strategy > final SSLContext sslcontext = SSLContexts.custom() > .loadTrustMaterial(new TrustStrategy() { > > @Override > public boolean isTrusted( > final X509Certificate[] chain, > final String authType) throws > CertificateException { > final X509Certificate cert = chain[0]; > return "CN=httpbin.org > ".equalsIgnoreCase(cert.getSubjectDN().getName()); > } > > }) > .build(); > // Allow TLSv1.2 protocol only > final SSLConnectionSocketFactory sslSocketFactory = > SSLConnectionSocketFactoryBuilder.create() > .setSslContext(SSLContexts.createSystemDefault()) > .setTlsVersions(TLS.V_1_2) > .build(); > final HttpClientConnectionManager cm = > PoolingHttpClientConnectionManagerBuilder.create() > .setSSLSocketFactory(sslSocketFactory) > .build(); > try (CloseableHttpClient httpclient = HttpClients.custom() > .setConnectionManager(cm) > .build()) { > > final HttpGet httpget = new HttpGet("https://httpbin.org/"); > > System.out.println("Executing request " + httpget.getMethod() > + " " + httpget.getUri()); > > final HttpClientContext clientContext = > HttpClientContext.create(); > try (CloseableHttpResponse response = > httpclient.execute(httpget, clientContext)) { > > System.out.println("----------------------------------------"); > System.out.println(response.getCode() + " " + > response.getReasonPhrase()); > > System.out.println(EntityUtils.toString(response.getEntity())); > > final SSLSession sslSession = > clientContext.getSSLSession(); > if (sslSession != null) { > System.out.println("SSL protocol " + > sslSession.getProtocol()); > System.out.println("SSL cipher suite " + > sslSession.getCipherSuite()); > } > } > } > } > > } > ============================================================= > > > > Regards > Somshekar C Kadam > 9036660538 > > > On Thu, Sep 5, 2019 at 4:47 PM Somshekar C Kadam <somkada...@gmail.com> > wrote: > > > Hi Yossi, > > > > will try and get back on this. > > > > Regards > > Somshekar C Kadam > > 9036660538 > > > > > > On Thu, Sep 5, 2019 at 3:24 PM <yo...@yossi.at> wrote: > > > >> One possible explanation for the 20 second delay is that the curl > >> call goes through a proxy (defined by the http_proxy/https_proxy > >> environment properties), while Java does not pick up these > >> properties. If this is indeed the case, you need to pass some system > properties in your java call. > >> See the documentation: > >> https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html > . > >> > >> Yossi. > >> > >> -----Original Message----- > >> From: Somshekar C Kadam <somkada...@gmail.com> > >> Sent: Thursday, 5 September 2019 12:45 > >> To: HttpClient User Discussion <httpclient-users@hc.apache.org> > >> Subject: Re: apache httpclient > >> > >> Hi Brenda, > >> > >> First of all thanks for your time and advice. > >> I am not asking for Arm, I was telling for Intel Ubuntu Linux > >> machine, not able to get it compiled. > >> > >> I will send error to you later. > >> > >> Regards Somshekar > >> > >> On Thu, Sep 5, 2019, 3:05 PM Bernd Eckenfels <e...@zusammenkunft.net> > >> wrote: > >> > >> > Hello, > >> > > >> > The URLConnection code looks fine (line reading is not the most > >> > performing way to do it and buffer size is probably on the small > >> > side but that should not be a deal breaker). Maybe you can add > >> > timestamp printing so you can see where the delay happens. > >> > (Especially is it while print_certs which means it is the > >> > connection/handshake or is the > >> print taking so long. > >> > > >> > BTW: when measuring you also should not print to console, that can > >> > be very slow on embedded devices (and in general) > >> > > >> > As soon as you provide us the error details we can help you with > >> > that, I don’t think there are specific compile instructions available > for arm. > >> > > >> > Gruss > >> > Bernd > >> > > >> > > >> > -- > >> > http://bernd.eckenfels.net > >> > > >> > ________________________________ > >> > Von: Somshekar C Kadam <somkada...@gmail.com> > >> > Gesendet: Donnerstag, September 5, 2019 11:15 AM > >> > An: HttpClient User Discussion > >> > Betreff: Re: apache httpclient > >> > > >> > Hi Bernd, > >> > > >> > Missed the sample program used > >> > 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 Thu, Sep 5, 2019 at 2:40 PM Somshekar C Kadam > >> > <somkada...@gmail.com> > >> > wrote: > >> > > >> > > Hi Bernd, > >> > > > >> > > On My Ubuntu Machine I am able to compile Intel based Java > >> > > programs no issue. > >> > > We have Armv7 target board openjdk installed, able to compile > >> > > java > >> > program > >> > > and run on the board no issues, > >> > > > >> > > I run the curl command on the armv7 target board, able to connect > >> > > to > >> > https > >> > > link and get the content, same when I use the program below > >> > > provided it takes 15 ~20 seconds more using httpsurlconenction. > >> > > > >> > > > >> > > Now I wanted to try out alternative Apache httpclient to check if > >> > > it can reduce time to connect same https link. I am not able to > >> > > compile the program, I will provide the details in a while (added > >> > > jar file for httpcore). So reuested to provide any link or steps > >> > > > >> > > Thanks in advance > >> > > > >> > > Regards > >> > > Somshekar C Kadam > >> > > 9036660538 > >> > > > >> > > > >> > > On Thu, Sep 5, 2019 at 2:30 PM Bernd Eckenfels > >> > > <e...@zusammenkunft.net> > >> > > wrote: > >> > > > >> > >> Hello, > >> > >> > >> > >> Are you able to compile and run any java programs? > >> > >> > >> > >> What is the error you are getting, what is the command you are > >> > >> using to compile it and how does your source directory looks like? > >> > >> > >> > >> You can compile the sample client on other machines, if this > >> > >> helps your development velocity. > >> > >> > >> > >> You can’t really compare native program (curl) speed with Java, > >> > >> but it certainly should not be that different (I mean yes you > >> > >> can, it just does not tell you much). Do you count startup Time? > >> > >> How did you Test Java if > >> > it > >> > >> does not compile? > >> > >> > >> > >> Is the only reason you look into HTTPClient the delay you see > >> > >> with URLConnection? Do you have a sample program for that which > >> > >> shows the slowness? > >> > >> Gruss > >> > >> Bernd > >> > >> > >> > >> > >> > >> -- > >> > >> http://bernd.eckenfels.net > >> > >> > >> > >> ________________________________ > >> > >> Von: Somshekar C Kadam <somkada...@gmail.com> > >> > >> Gesendet: Donnerstag, September 5, 2019 10:53 AM > >> > >> An: HttpClient User Discussion; Somshekar kadam > >> > >> Betreff: Re: apache httpclient > >> > >> > >> > >> Hi Bernd, > >> > >> Thanks for the quick reply. > >> > >> Excuse me on the replyall part, my bad. > >> > >> > >> > >> when I use curl same https connection quickly returns within 2 > >> > >> seconds, ofcourse different cipher is used. > >> > >> Also I am not able to get sample apache httpclient compiled on > >> > >> Ubuntu Linux machine, any link or steps which I can get to make > >> > >> it compile and work will help. > >> > >> > >> > >> code > >> > >> ============= > >> > >> package org.apache.hc.client5.http.examples; > >> > >> > >> > >> import java.security.cert.CertificateException; > >> > >> import java.security.cert.X509Certificate; > >> > >> > >> > >> import javax.net.ssl.SSLContext; import > >> > >> javax.net.ssl.SSLSession; > >> > >> > >> > >> import org.apache.hc.client5.http.classic.methods.HttpGet; > >> > >> import > >> > >> org.apache.hc.client5.http.impl.classic.CloseableHttpClient; > >> > >> import > >> > >> org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; > >> > >> import org.apache.hc.client5.http.impl.classic.HttpClients; > >> > >> import > >> > >> org.apache.hc.client5.http.impl.io > >> > >> .PoolingHttpClientConnectionManagerBuilder; > >> > >> import > >> > >> org.apache.hc.client5.http.io.HttpClientConnectionManager; > >> > >> import org.apache.hc.client5.http.protocol.HttpClientContext; > >> > >> import > >> > >> org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory; > >> > >> import > >> > >> org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder > >> > >> ; import org.apache.hc.core5.http.io.entity.EntityUtils; > >> > >> import org.apache.hc.core5.http.ssl.TLS; import > >> > >> org.apache.hc.core5.ssl.SSLContexts; > >> > >> import org.apache.hc.core5.ssl.TrustStrategy; > >> > >> > >> > >> /** > >> > >> * This example demonstrates how to create secure connections > >> > >> with a > >> > custom > >> > >> SSL > >> > >> * context. > >> > >> */ > >> > >> public class ClientCustomSSL { > >> > >> > >> > >> public final static void main(final String[] args) throws > >> > >> Exception { // Trust standard CA and those trusted by our custom > >> > >> strategy final SSLContext sslcontext = SSLContexts.custom() > >> > >> .loadTrustMaterial(new TrustStrategy() { > >> > >> > >> > >> @Override > >> > >> public boolean isTrusted( > >> > >> final X509Certificate[] chain, > >> > >> final String authType) throws > >> > >> CertificateException { > >> > >> final X509Certificate cert = chain[0]; return "CN=httpbin.org > >> > >> ".equalsIgnoreCase(cert.getSubjectDN().getName()); > >> > >> } > >> > >> > >> > >> }) > >> > >> .build(); > >> > >> // Allow TLSv1.2 protocol only > >> > >> final SSLConnectionSocketFactory sslSocketFactory = > >> > >> SSLConnectionSocketFactoryBuilder.create() > >> > >> .setSslContext(SSLContexts.createSystemDefault()) > >> > >> .setTlsVersions(TLS.V_1_2) > >> > >> .build(); > >> > >> final HttpClientConnectionManager cm = > >> > >> PoolingHttpClientConnectionManagerBuilder.create() > >> > >> .setSSLSocketFactory(sslSocketFactory) > >> > >> .build(); > >> > >> try (CloseableHttpClient httpclient = HttpClients.custom() > >> > >> .setConnectionManager(cm) > >> > >> .build()) { > >> > >> > >> > >> final HttpGet httpget = new HttpGet("https://httpbin.org/"); > >> > >> > >> > >> System.out.println("Executing request " + httpget.getMethod() + " " > >> > >> + httpget.getUri()); > >> > >> > >> > >> final HttpClientContext clientContext = > >> > >> HttpClientContext.create(); try (CloseableHttpResponse response > >> > >> = httpclient.execute(httpget, > >> > >> clientContext)) { > >> > >> > >> > >> System.out.println("----------------------------------------"); > >> > >> System.out.println(response.getCode() + " " + > >> > >> response.getReasonPhrase()); > >> > >> > >> > >> System.out.println(EntityUtils.toString(response.getEntity())); > >> > >> > >> > >> final SSLSession sslSession = clientContext.getSSLSession(); if > >> > >> (sslSession != null) { System.out.println("SSL protocol " + > >> > >> sslSession.getProtocol()); System.out.println("SSL cipher suite > >> > >> " + sslSession.getCipherSuite()); } } } } > >> > >> > >> > >> } > >> > >> =================== > >> > >> > >> > >> Regards > >> > >> Somshekar C Kadam > >> > >> 9036660538 > >> > >> > >> > >> > >> > >> On Thu, Sep 5, 2019 at 2:09 PM Bernd Eckenfels > >> > >> <e...@zusammenkunft.net> > >> > >> wrote: > >> > >> > >> > >> > Hello, > >> > >> > > >> > >> > Certainly you can use the Apache HTTPClient to replace > >> > >> > URLConnection, > >> > >> you > >> > >> > don’t need to do anything special on ARM other than having > >> > >> > Java > >> > Runtime > >> > >> > installed. > >> > >> > > >> > >> > If you have a slow http download changes are high this is > >> > >> > caused by > >> > slow > >> > >> > CPU, missing random numbers, slow network or server. All those > >> > >> conditions > >> > >> > might affect URLConnection or HTTPClient, so there is no > >> > >> > guarantee > >> > that > >> > >> > switching to Apache HTTPClient will improve things. > >> > >> > > >> > >> > BTW your CC List is insane, why would you want to bother > >> > >> > people like > >> > >> that? > >> > >> > Gruss > >> > >> > Bernd > >> > >> > > >> > >> > > >> > >> > -- > >> > >> > http://bernd.eckenfels.net > >> > >> > > >> > >> > ________________________________ > >> > >> > Von: Somshekar C Kadam <somkada...@gmail.com> > >> > >> > Gesendet: Donnerstag, September 5, 2019 10:26 AM > >> > >> > An: HttpClient User Discussion > >> > >> > Cc: annou...@apache.org; priv...@hc.apache.org; > >> > >> > d...@hc.apache.org > >> > >> > Betreff: apache httpclient > >> > >> > > >> > >> > Hi All, > >> > >> > I am a newbie to Java. > >> > >> > We are going to try Apache httpclient as an alternative for > >> > >> > openjdk httpsurl connection class. > >> > >> > > >> > >> > We see that using openjdk 8 and above we s eee that when using > >> > httpsurl > >> > >> > conenction we see a delay of 10 to 20 seconds to get content > >> > >> > of the > >> > >> url. We > >> > >> > use Armv7, Linux. We wanted first to begin with to get normal > >> > httpclient > >> > >> > working on Ubuntu Linux machine. > >> > >> > Dont find any steps to get it working, is there any link how > >> > >> > to use it > >> > >> on > >> > >> > ubuntu machine httpclient working, please point. > >> > >> > > >> > >> > Also you like to know hopefully this approach is correct to > >> > >> > try Apachr httpsclient instaed of openjdk httpsurlconnection. > >> > >> > please advice > >> > >> > Regards > >> > >> > Somshekar C Kadam > >> > >> > 9036660538 > >> > >> > > >> > >> > > >> > >> > On Thu, Sep 5, 2019 at 1:52 PM Oleg Kalnichevski > >> > >> > <ol...@apache.org> > >> > >> wrote: > >> > >> > > >> > >> > > The Apache HttpComponents project is pleased to announce > >> > >> > > 4.4.12 GA release of HttpComponents Core. > >> > >> > > > >> > >> > > This is a maintenance release that corrects a number of > >> > >> > > defects discovered since release 4.4.11. > >> > >> > > > >> > >> > > Please note that as of 4.4 HttpCore requires Java 1.6 or newer. > >> > >> > > > >> > >> > > IMPORTANT: Users of HttpCore 4.x GA releases are strongly > >> > >> > > encouraged > >> > >> to > >> > >> > > evaluate new HttpCore 5.0 APIs and give the project > >> > >> > > developers feedback, share critique or propose changes. > >> > >> > > > >> > >> > > Download - > >> > >> > > <http://hc.apache.org/downloads.cgi> > >> > >> > > Release notes - > >> > >> > > < > >> > http://www.apache.org/dist/httpcomponents/httpcore/RELEASE_NOTES.tx > >> > t > >> > >> > > >> > >> > > HttpComponents site - > >> > >> > > <http://hc.apache.org/> > >> > >> > > > >> > >> > > About HttpComponents Core > >> > >> > > > >> > >> > > HttpCore is a set of low level HTTP transport components > >> > >> > > that can be used to build custom client and server side HTTP > >> > >> > > services with a minimal footprint. HttpCore supports two I/O > >> > >> > > models: a blocking I/O model based on the classic Java I/O > >> > >> > > and a non-blocking, event driven I/O model based on Java NIO. > >> > >> > > > >> > >> > > > >> > >> > > > >> > >> > > > >> > ------------------------------------------------------------------- > >> > -- > >> > >> > > To unsubscribe, e-mail: > >> > >> > > httpclient-users-unsubscr...@hc.apache.org > >> > >> > > For additional commands, e-mail: > >> > httpclient-users-h...@hc.apache.org > >> > >> > > > >> > >> > > > >> > >> > > >> > >> > >> > > > >> > > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org > >> For additional commands, e-mail: httpclient-users-h...@hc.apache.org > >> > >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org > For additional commands, e-mail: httpclient-users-h...@hc.apache.org > >