Hello, The sample code expects a truststore file named my.keystore in the current runtime directory with password „nopassword“, you need to provide one it seems. I guess if you use official certificates you don’t need that part of the customization.
The Java keytool command can be used to import certificates into new keystore files. BTW it might be easier to hire someone with Java experience. Gruß Bernd -- https://Bernd.eckenfels.net ________________________________ Von: Somshekar C Kadam <[email protected]> Gesendet: Donnerstag, September 12, 2019 1:21 PM An: HttpClient User Discussion Betreff: Re: apache httpclient Hi Bernd Thanks for the information, its now able to load truststrategy class seen in verbose logs, now facing Exception in thread "main" java.io.FileNotFoundException: my.keystore (No such file or directory) issue, if you have any suggestions. thanks in advance somshekar@celsys041:~$ sudo java -classpath .:/home/somshekar/Downloads/httpcomponents-client-4.5.10/lib/commons-codec-1.11.jar:/home/somshekar/Downloads/httpcomponents-client-4.5.10/lib/commons-logging-1.2.jar:/home/somshekar/Downloads/httpcomponents-client-4.5.10/lib/fluent-hc-4.5.10.jar:/home/somshekar/Downloads/httpcomponents-client-4.5.10/lib/httpclient-4.5.10.jar:/home/somshekar/Downloads/httpcomponents-client-4.5.10/lib/httpclient-cache-4.5.10.jar:/home/somshekar/Downloads/httpcomponents-client-4.5.10/lib/httpclient-osgi-4.5.10.jar:httpclient-win-4.5.10.jar:/home/somshekar/Downloads/httpcomponents-client-4.5.10/lib/httpcore-4.4.12.jar:httpmime-4.5.10.jar:/home/somshekar/Downloads/httpcomponents-client-4.5.10/lib/jna-4.5.2.jar:/home/somshekar/Downloads/httpcomponents-client-4.5.10/lib/jna-platform-4.5.2.jar org.apache.http.examples.client.ClientCustomSSL Exception in thread "main" java.io.FileNotFoundException: my.keystore (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.<init>(FileInputStream.java:138) at org.apache.http.ssl.SSLContextBuilder.loadTrustMaterial(SSLContextBuilder.java:253) at org.apache.http.examples.client.ClientCustomSSL.main(ClientCustomSSL.java:52) Regards Somshekar C Kadam 9036660538 On Fri, Sep 6, 2019 at 11:29 PM Bernd Eckenfels <[email protected]> wrote: > You need to specify the classpath and the full class name (including > package). > > -- > https://Bernd.eckenfels.net > > ________________________________ > Von: Somshekar C Kadam <[email protected]> > Gesendet: Freitag, September 6, 2019 1:29 PM > An: HttpClient User Discussion > Betreff: Re: apache httpclient > > Hi Bernd and Yossi, > > I am not sure what else I need to do on this stuck > Did give the classpath while executing as mentioned by Bernd and Yossi. > > somshekar@celsys041:~$ sudo java -classpath > > /home/somshekar/Downloads/httpcomponents-core-4.4.12/lib/httpcore-4.4.12.jar:/home/somshekar/akshay/java-jvms/httpcomponents-client-4.5.9/lib/httpclient-4.5.9.jar > ClientCustomSSL > Error: Could not find or load main class ClientCustomSSL > > somshekar@celsys041:~$ sudo java -classpath > > /home/somshekar/Downloads/httpcomponents-core-4.4.12/lib/httpcore-4.4.12.jar:/home/somshekar/akshay/java-jvms/httpcomponents-client-4.5.9/lib/httpclient-4.5.9.jar:/home/somshekar/ClientCustomSSL.class > ClientCustomSSL > Error: Could not find or load main class ClientCustomSSL > > somshekar@celsys041:~$ pwd > /home/somshekar > somshekar@celsys041:~$ file ClientCustomSSL.class > ClientCustomSSL.class: compiled Java class data, version 52.0 (Java 1.8) > somshekar@celsys041:~$ > > Regards > Somshekar C Kadam > 9036660538 > > > On Fri, Sep 6, 2019 at 2:13 PM Bernd Eckenfels <[email protected]> > wrote: > > > You are not specifying a classpath? TrustStrategy is part of > > httpcomponents-core. > > > > > > -- > > http://bernd.eckenfels.net > > > > ________________________________ > > Von: Somshekar C Kadam <[email protected]> > > Gesendet: Freitag, September 6, 2019 10:21 AM > > An: HttpClient User Discussion > > Betreff: Re: apache httpclient > > > > Hi Yossi and Bernd, > > > > Seems other issue path are all proper > > > > somshekar@celsys041:~$ java > > org.apache.http.examples.client.ClientCustomSSL > > Error: A JNI error has occurred, please check your installation and try > > again > > Exception in thread "main" java.lang.NoClassDefFoundError: > > org/apache/http/ssl/TrustStrategy > > at java.lang.Class.getDeclaredMethods0(Native Method) > > at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) > > at java.lang.Class.privateGetMethodRecursive(Class.java:3048) > > at java.lang.Class.getMethod0(Class.java:3018) > > at java.lang.Class.getMethod(Class.java:1784) > > at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) > > at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) > > Caused by: java.lang.ClassNotFoundException: > > org.apache.http.ssl.TrustStrategy > > at java.net.URLClassLoader.findClass(URLClassLoader.java:382) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:424) > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:357) > > ... 7 more > > > > Regards > > Somshekar C Kadam > > 9036660538 > > > > > > On Thu, Sep 5, 2019 at 9:17 PM Somshekar C Kadam <[email protected]> > > wrote: > > > > > Yes Yossi I think I need to do that, Thanks a lot for your suggestions > > and > > > support. > > > > > > Regards Somshekar > > > > > > On Thu, Sep 5, 2019, 8:48 PM <[email protected]> wrote: > > > > > >> Your class should also be in the classpath. Add > > >> ";path/ClientCustomSSL.class" to your class path. > > >> (This is basic Java stuff, unrelated to HC. Maybe you should do some > > Java > > >> tutorial first, or if possible start using an IDE, which simplifies a > > lot > > >> of these issues.) > > >> > > >> -----Original Message----- > > >> From: Somshekar C Kadam <[email protected]> > > >> Sent: Thursday, 5 September 2019 16:51 > > >> To: HttpClient User Discussion <[email protected]> > > >> Subject: Re: apache httpclient > > >> > > >> Hi Yossi, > > >> tried the same > > >> > > >> somshekar@celsys041:~$ java -classpath > > >> > > >> > > > /home/somshekar/akshay/java-jvms/httpcomponents-client-4.5.9/lib/httpclient-4.5.9.jar:/home/somshekar/akshay/java-jvms/httpcomponents-client-4.5.9/lib/httpcore-4.4.11.jar:/home/somshekar/akshay/java-jvms/httpcomponents-client-4.5.9/lib/httpclient-osgi-4.5.9.jar:/home/somshekar/akshay/java-jvms/httpcomponents-client-4.5.9/lib/httpclient-cache-4.5.9.jar > > >> org.apache.http.examples.client.ClientCustomSSL > > >> Error: Could not find or load main class > > >> org.apache.http.examples.client.ClientCustomSSL > > >> > > >> same even with sudo, not sure why am I missing naything else Sorry for > > >> many mails on this > > >> > > >> thanks in advance > > >> > > >> Regards > > >> Somshekar C Kadam > > >> 9036660538 > > >> > > >> > > >> On Thu, Sep 5, 2019 at 6:46 PM <[email protected]> wrote: > > >> > > >> > You need to specify the full package name of the main class (in your > > >> > case org.apache.http.examples.client.ClientCustomSSL). > > >> > > > >> > -----Original Message----- > > >> > From: Somshekar C Kadam <[email protected]> > > >> > Sent: Thursday, 5 September 2019 16:14 > > >> > To: HttpClient User Discussion <[email protected]> > > >> > Subject: Re: apache httpclient > > >> > > > >> > Hi Yossi, > > >> > Thanks you are right, I did put all jar files and compiled it, now > it > > >> > compiles successfully able to create class file. > > >> > > > >> > compile command > > >> > > > >> > javac -classpath > > >> > > > >> > > /home/somshekar/akshay/java-jvms/httpcomponents-client-4.5.9/lib/httpc > > >> > > lient-4.5.9.jar:/home/somshekar/akshay/java-jvms/httpcomponents-client > > >> > > -4.5.9/lib/httpcore-4.4.11.jar:/home/somshekar/akshay/java-jvms/httpco > > >> > > mponents-client-4.5.9/lib/httpclient-osgi-4.5.9.jar:/home/somshekar/ak > > >> > > shay/java-jvms/httpcomponents-client-4.5.9/lib/httpclient-cache-4.5.9. > > >> > jar > > >> > ClientCustomSSL.java > > >> > > > >> > > > >> > somshekar@celsys041:~$ file ClientCustomSSL.class > > >> > ClientCustomSSL.class: compiled Java class data, version 52.0 (Java > > >> > 1.8) > > >> > > > >> > > > >> > when I try to run it, it gives below error, do I have to specify the > > >> > classpath at runtime also > > >> > > > >> > somshekar@celsys041:~$ sudo java -classpath > > >> > > /home/somshekar/akshay/java-jvms/httpcomponents-client-4.5.9/lib/httpc > > >> > > lient-4.5.9.jar:/home/somshekar/akshay/java-jvms/httpcomponents-client > > >> > > -4.5.9/lib/httpcore-4.4.11.jar:/home/somshekar/akshay/java-jvms/httpco > > >> > > mponents-client-4.5.9/lib/httpclient-osgi-4.5.9.jar:/home/somshekar/ak > > >> > > shay/java-jvms/httpcomponents-client-4.5.9/lib/httpclient-cache-4.5.9. > > >> > jar > > >> > ClientCustomSSL > > >> > Error: Could not find or load main class ClientCustomSSL > > >> > > > >> > thanks in advance > > >> > Regards > > >> > Somshekar C Kadam > > >> > 9036660538 > > >> > > > >> > > > >> > On Thu, Sep 5, 2019 at 6:33 PM <[email protected]> wrote: > > >> > > > >> > > It seems that you are only putting httpclient-4.5.9.jar in your > > >> > > classpath, but it has dependencies on other JARs itself. Most > > >> > > importantly, it depends on HttpCore, part of the same project. You > > >> > > can see the dependencies, and their own dependencies, recursively, > > >> > > at > > >> > > > > https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcli > > >> > > en > > >> > > t/4.5.9 > > >> > > . > > >> > > Collecting all the transitive dependencies for Java projects > > >> > > manually can become quite time-consuming. You can definitely do it > > >> > > for this test, but I recommend learning how to use Maven. > > >> > > > > >> > > -----Original Message----- > > >> > > From: Somshekar C Kadam <[email protected]> > > >> > > Sent: Thursday, 5 September 2019 15:40 > > >> > > To: HttpClient User Discussion <[email protected]> > > >> > > Subject: Re: apache httpclient > > >> > > > > >> > > 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/htt > > >> > > pc > > >> > > lient-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 <[email protected]> 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 <[email protected]> > > >> > > > Sent: Thursday, 5 September 2019 14:28 > > >> > > > To: HttpClient User Discussion <[email protected]> > > >> > > > 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/h > > >> > > > tt > > >> > > > pc > > >> > > > ore-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 > > >> > > > <[email protected]> > > >> > > > wrote: > > >> > > > > > >> > > > > Hi Yossi, > > >> > > > > > > >> > > > > will try and get back on this. > > >> > > > > > > >> > > > > Regards > > >> > > > > Somshekar C Kadam > > >> > > > > 9036660538 > > >> > > > > > > >> > > > > > > >> > > > > On Thu, Sep 5, 2019 at 3:24 PM <[email protected]> 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 <[email protected]> > > >> > > > >> Sent: Thursday, 5 September 2019 12:45 > > >> > > > >> To: HttpClient User Discussion < > [email protected] > > > > > >> > > > >> 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 > > >> > > > >> <[email protected]> > > >> > > > >> 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 <[email protected]> > > >> > > > >> > 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 > > >> > > > >> > <[email protected]> > > >> > > > >> > 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 > > >> > > > >> > > <[email protected]> > > >> > > > >> > > 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 <[email protected]> > > >> > > > >> > >> 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.CloseableHttpClien > > >> > > > >> > >> t; > > >> > > > >> > >> import > > >> > > > >> > >> > org.apache.hc.client5.http.impl.classic.CloseableHttpRespo > > >> > > > >> > >> ns > > >> > > > >> > >> e; 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.SSLConnectionSocketFactoryB > > >> > > > >> > >> ui > > >> > > > >> > >> ld er ; 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 > > >> > > > >> > >> <[email protected]> > > >> > > > >> > >> 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 <[email protected]> > > >> > > > >> > >> > Gesendet: Donnerstag, September 5, 2019 10:26 AM > > >> > > > >> > >> > An: HttpClient User Discussion > > >> > > > >> > >> > Cc: [email protected]; [email protected]; > > >> > > > >> > >> > [email protected] > > >> > > > >> > >> > 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 > > >> > > > >> > >> > <[email protected]> > > >> > > > >> > >> 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: > > >> > > > >> > >> > > [email protected] > > >> > > > >> > >> > > For additional commands, e-mail: > > >> > > > >> > [email protected] > > >> > > > >> > >> > > > > >> > > > >> > >> > > > > >> > > > >> > >> > > > >> > > > >> > >> > > >> > > > >> > > > > >> > > > >> > > > >> > > > >> > > >> > > > >> > > >> > > > >> > --------------------------------------------------------------- > > >> > > > >> -- > > >> > > > >> -- > > >> > > > >> -- To unsubscribe, e-mail: > > >> > > > >> [email protected] > > >> > > > >> For additional commands, e-mail: > > >> > > > >> [email protected] > > >> > > > >> > > >> > > > >> > > >> > > > > > >> > > > > > >> > > > > ------------------------------------------------------------------ > > >> > > > -- > > >> > > > - To unsubscribe, e-mail: > > >> > > > [email protected] > > >> > > > For additional commands, e-mail: > > >> > > > [email protected] > > >> > > > > > >> > > > > > >> > > > > >> > > > > >> > > > > >> > > > -------------------------------------------------------------------- > > >> > > - To unsubscribe, e-mail: > > [email protected] > > >> > > For additional commands, e-mail: > > [email protected] > > >> > > > > >> > > > > >> > > > >> > > > >> > > > >> > > --------------------------------------------------------------------- > > >> > To unsubscribe, e-mail: [email protected] > > >> > For additional commands, e-mail: > [email protected] > > >> > > > >> > > > >> > > >> > > >> > > >> --------------------------------------------------------------------- > > >> To unsubscribe, e-mail: [email protected] > > >> For additional commands, e-mail: [email protected] > > >> > > >> > > >
