Java Code Examples for org.apache.http.conn.ManagedHttpClientConnection#getSSLSession()
The following examples show how to use
org.apache.http.conn.ManagedHttpClientConnection#getSSLSession() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SavingConnectionDetailsHttpResponseInterceptor.java From vividus with Apache License 2.0 | 6 votes |
@Override public void process(HttpResponse response, HttpContext context) { ManagedHttpClientConnection routedConnection = (ManagedHttpClientConnection) context .getAttribute(HttpCoreContext.HTTP_CONNECTION); // Connection may be stale, when no response body is returned if (routedConnection.isOpen() && (response.getEntity() != null || !routedConnection.isStale())) { SSLSession sslSession = routedConnection.getSSLSession(); boolean secure = sslSession != null; ConnectionDetails connectionDetails = new ConnectionDetails(); connectionDetails.setSecure(secure); if (secure) { connectionDetails.setSecurityProtocol(sslSession.getProtocol()); } httpTestContext.putConnectionDetails(connectionDetails); } }
Example 2
Source File: SSLCertificateLoader.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
private HttpResponseInterceptor getHttpResponseInterceptor() { return new HttpResponseInterceptor() { @Override public void process(HttpResponse response, HttpContext context) throws HttpException, IOException { ManagedHttpClientConnection routedConnection = (ManagedHttpClientConnection)context.getAttribute(HttpCoreContext.HTTP_CONNECTION); SSLSession sslSession = routedConnection.getSSLSession(); if (sslSession != null) { Certificate[] certificates = sslSession.getPeerCertificates(); context.setAttribute(PEER_CERTIFICATES, certificates); } } }; }