apache-httpclient-4.x

javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated issue

妖精的绣舞 提交于 2019-12-04 17:14:10
I am using HttpClient-4.2.1 and already added certificate on server but still I am getting below error. I have read existing issue saying to add TrustManager ( X509TrustManager ) but as per my thinking this is not solution. If I am wrong please correct me. javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated at sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:397) at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128) at org.apache.http.conn.ssl.SSLSocketFactory

Why does me use HttpClients.createDefault() as HttpClient singleton instance execute third request always hang

杀马特。学长 韩版系。学妹 提交于 2019-12-04 15:55:15
All , I create : public static final HttpClient DEFAULT_HTTPCLIENT = HttpClients .createDefault(); for(int i=0 ; i<5; i++){ DEFAULT_HTTPCLIENT.execute(requests[i]); } But when loop is to i =2 , that means just execute first two request , till third request , the client will hang and seems dead loop . I refer some materials , I got may be caused by Http Thread Pool configuration limited . But I know what is standard solutions for this issue ? Since I want to send any request any times, but I don't want each time to create new HttpClient . So Do you have any good and standard suggestions for

Using Apache HttpComponents for http requests with NTLM authentication

穿精又带淫゛_ 提交于 2019-12-04 13:45:31
Quick background. CFHTTP doesn't support Windows NTLM/Authenticate authentication, only basic authentication. I need to make http requests that will have to authenticate against NTLM, so I've ended up rolling my own version of CFHTTP. I found Terry Ryan's article that uses the apache httpclient version 3.1 to perform digest authentication and have built upon that using version 4.1.2 instead which includes NTLM functionality. I have a function that will perform a get request and then other functions to handle returning a structure that looks like the cfhttp result set. The changes I made are

javax.net.ssl.SSLPeerUnverifiedException: No peer certificate while I am working with google place api in android [duplicate]

霸气de小男生 提交于 2019-12-04 12:01:54
问题 This question already has answers here : Android: Making Https Request (2 answers) Closed 6 years ago . I am facing an javax.net.ssl.SSLPeerUnverifiedException: No peer certificate exception while working with google place api in android emulator.Below is my url: https://maps.googleapis.com/maps/api/place/search/json?&location=28.632808,77.218276&radius=1000&sensor=false&key=AIzaSyC3y3fOMTqTkCjNNETQTCKustG7BRk_eVc when i simply , paste above url in browser address bar , it simple gives Json

SSLHandshakeException: hostname in certificate didn't match

核能气质少年 提交于 2019-12-04 11:42:40
I am writing a system that must make a multipart post to a server (a third-party program called ARX that is currently running on localhost during the development) that has a self-signed certificate. I tried to find its certificate, but can only find three different jks files; server.jks , servertrust.jks and serverca.jks . I have tried to use the System.setProperty("javax.net.ssl.trustStore", "Program Files\\<path>\\jksfile") with each of the jks files. However; when I do, I get the following error: hostname in certificate didn't match: < localhost> != <9200416 arx sa cert> . I have browsed

ThreadSafeClientConnManager not multithreading

一曲冷凌霜 提交于 2019-12-04 11:25:19
I've been asked to fix up a Servlet that sits in between two applications. It's purpose is to convert SAML authorisation request to and from SAML v2.0 / SAML 1.1 . So it: receives a HTTP SAML v2.0 authorisation request from one app converts the request into SAML v1.1 sends the request to the second app receives the SAML v1.1 response from the second app converts the response into SAML v2.0 sends the response back to the first app Don't worry about the SAML stuff, it's the HTTP stuff that's the problem. The code does it's job, but it suffers greatly under load. I've found through testing that

Apache http client defaults don't work with sni

只愿长相守 提交于 2019-12-04 10:24:20
PRIMARY QUESTION Is there a bug I'm not aware of with the latest 4.x apache http client? or a setting that I'm missing to get sni to work? On/in the same jvm (in this case 1.7.0_45). I run the following two pieces of code to pull an https url that requires SNI for it to connect correctly. The 1st piece of code uses java's built in java.net.* approach, and the 2nd piece of code uses org.apache.http.* (version 4.5) approach. Approach with java.net.* public final class JavaNetHitApi extends BaseHitApi { @Override public JSONObject hitAPI(final String url) throws IOException { URL toUse = new URL

Apache HttpClient and custom ports

℡╲_俬逩灬. 提交于 2019-12-04 10:03:13
问题 I'm using the Apache HttpClient 4 and it works fine. The only thing that doesn't work is custom ports. It seems like the root directory is fetched and the port is ignored. HttpPost post = new HttpPost("http://myserver.com:50000"); HttpResponse response = httpClient.execute(post); If no port is defined, http- and https-connections work well. The scheme registry is defined as follows: final SchemeRegistry sr = new SchemeRegistry(); final Scheme http = new Scheme("http", 80, PlainSocketFactory

Parsing JSON from HttpClient request using JSON.org parser

倾然丶 夕夏残阳落幕 提交于 2019-12-04 07:31:53
I am trying to parse JSON using a Notes agent, JSON is fetched using Apache HttpClient. Here is the code that return the JSON import lotus.domino.*; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.HttpClientBuilder; Session session = getSession(); AgentContext agentContext = session.getAgentContext(); HttpClient client = HttpClientBuilder.create().build(); HttpGet request = new HttpGet("http://api.acme.com/customer"); request.addHeader("accept", "application/json"); request

How do I create an async caching http client?

此生再无相见时 提交于 2019-12-04 07:04:37
问题 Using the org.apache.httpcomponents:httpasyncclient-cache:4.1.3 library, I'm trying to work out how I can create an asynchronous caching http client? I can create each individually, using their respective builders, but I can't find a way to have both. e.g. CloseableHttpClient client = CachingHttpClientBuilder.create() .setCacheConfig(cacheConfig()) .build(); CloseableHttpAsyncClient build = HttpAsyncClientBuilder.create() .build(); Por que no los dos? N.B. I'm not tied to this version of the