[ANNOUNCEMENT] HttpComponents Client 5.0 beta5 (GA candidate) released

2019-07-22 Thread Oleg Kalnichevski
The Apache HttpComponents project is pleased to announce 5.0-beta5
release of HttpComponents Client. 

This BETA release picks up the latest fixes and performance
improvements from HttpCore and addresses a number of issues found since
the previous BETA release.

IMPORTANT: This release is expected to be the last BETA version. If no
major design flaws are found the actual 5.0 API will be frozen and the
next version will be promoted to GA.


Notable changes and features in the 5.0 series:
---

* Support for the HTTP/2 protocol and conformance to requirements and
recommendations of the latest HTTP/2 protocol specification documents
(RFC 7540, RFC 7541.)

  Supported features:

** HPACK header compression
** Stream multiplexing (client and server)
** Flow control
** Response push
** Message trailers
** Expect-continue handshake
** Connection validation (ping)
** Application-layer protocol negotiation (ALPN)
** TLS 1.2 security features

* Improved conformance to requirements and recommendations of the
latest HTTP/1.1 protocol specification documents (RFC 7230, RFC 7231.)

* New connection pool implementation with lax connection limit
guarantees and better performance under higher concurrency due to
absence of a global pool lock.

* Package name space changed to 'org.apache.hc.client5'.

* Maven group id changed to 'org.apache.httpcomponents.client5'.

HttpClient 5.0 releases can be co-located with earlier major versions
on the same classpath due to the change in package names and Maven
module coordinates.

The 5.0 APIs are considered feature complete and are not expected to
undergo any major changes anymore. The focus of development is now
shifting to API polish, code stabilization and documentation
improvements.

Download - 
Release notes - <


https://www.apache.org/dist/httpcomponents/httpclient/RELEASE_NOTES-5.0.x.txt
> 

HttpComponents site - 

About HttpComponents HttpClient

The Hyper-Text Transfer Protocol (HTTP) is perhaps the most significant
protocol used on the Internet today. Web services, network-enabled
appliances and the growth of network computing continue to expand the
role of the HTTP protocol beyond user-driven web browsers, while
increasing the number of applications that require HTTP support.

Although the java.net package provides basic functionality for
accessing resources via HTTP, it doesn't provide the full flexibility
or functionality needed by many applications. HttpClient seeks to fill
this void by providing an efficient, up-to-date, and feature-rich
package implementing the client side of the most recent HTTP standards
and recommendations.

Designed for extension while providing robust support for the base HTTP
protocol, HttpClient may be of interest to anyone building HTTP-aware
client applications such as web browsers, web service clients, or
systems that leverage or extend the HTTP protocol for distributed
communication.



-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



org.apache.hc.core5.http.NoHttpResponseException: localhost:8112 failed to respond

2019-07-22 Thread Petar Tahchiev
Hello,
I have a Tomcat server running on port 8112 via HTTPS. The Tomcat has http2
enabled and is running with OpenJDK11.
Now when I try to connect with HTTPClient 5.0-beta5 I get this exception:
===
2019-07-22 12:22:57,699 [https-jsse-nio-8443-exec-2] INFO : Recoverable I/O
exception (org.apache.hc.core5.http.NoHttpResponseException) caught when
processing request to {s}->https://localhost:8112
2019-07-22 12:22:57,709 [https-jsse-nio-8443-exec-2] INFO : Recoverable I/O
exception (org.apache.hc.core5.http.NoHttpResponseException) caught when
processing request to {s}->https://localhost:8112
2019-07-22 12:22:57,719 [https-jsse-nio-8443-exec-2] INFO : Recoverable I/O
exception (org.apache.hc.core5.http.NoHttpResponseException) caught when
processing request to {s}->https://localhost:8112
2019-07-22 12:22:57,732 [https-jsse-nio-8443-exec-2] ERROR: localhost:8112
failed to respond
org.apache.hc.core5.http.NoHttpResponseException: localhost:8112 failed to
respond
at
org.apache.hc.core5.http.impl.io.DefaultHttpResponseParser.createConnectionClosedException(DefaultHttpResponseParser.java:87)
at
org.apache.hc.core5.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:243)
at
org.apache.hc.core5.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:53)
at
org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:187)
at
org.apache.hc.core5.http.impl.io.HttpRequestExecutor.execute(HttpRequestExecutor.java:181)
at
org.apache.hc.core5.http.impl.io.HttpRequestExecutor.execute(HttpRequestExecutor.java:224)
at
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager$InternalConnectionEndpoint.execute(PoolingHttpClientConnectionManager.java:596)
at
org.apache.hc.client5.http.impl.classic.InternalExecRuntime.execute(InternalExecRuntime.java:220)
at
org.apache.hc.client5.http.impl.classic.MainClientExec.execute(MainClientExec.java:107)
at
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
at
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
at
org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:181)
at
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
at
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
at
org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:165)
at
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
at
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
at
org.apache.hc.client5.http.impl.classic.RetryExec.execute(RetryExec.java:88)
at
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
at
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
at
org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116)
at
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
at
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
at
org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:125)
at
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
at
org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:175)
at
org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:77)
at
com.nemesis.console.backend.storefront.DefaultRestAuthenticationProvider.authenticate(DefaultRestAuthenticationProvider.java:116)
===

 - If I change the URL from https://localhost:8112/storefront/rest/auth to
https://some-website-with-valid-certificate.com/ it all works fine.
 - If I change the Tomcat server to work with HTTP1.1 it all works fine.
 Here is my code:
===

try {
// 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 {
return true;
}

}).build();

int timeout = 5;

RequestConfig config =
RequestConfig.custom().setResponseTimeout(timeout,
TimeUnit.SECONDS).setConnectTimeout(timeout,
TimeUnit.SECONDS).build();

// Allow TLSv1.2 protocol only
final SSLConnectionSocketFactory sslSocketFactory =
SSLConnectionSocketFactoryBuilder.create().setSslContext(sslcontext).setTlsVersions(TLS.V_1_2)


.setHostnameVerifier(NoopHostnameVerifier.INSTANCE).build();

Registry registry =
RegistryBuilder.create().register("https",
sslSocketFactory).build();

HttpClientConnectionManager ccm = new
PoolingHttpClie

Re: org.apache.hc.core5.http.NoHttpResponseException: localhost:8112 failed to respond

2019-07-22 Thread Oleg Kalnichevski
On Mon, 2019-07-22 at 12:29 +0300, Petar Tahchiev wrote:
> Hello,
> I have a Tomcat server running on port 8112 via HTTPS. The Tomcat has
> http2
> enabled and is running with OpenJDK11.
> Now when I try to connect with HTTPClient 5.0-beta5 I get this
> exception:
> ===
> 2019-07-22 12:22:57,699 [https-jsse-nio-8443-exec-2] INFO :
> Recoverable I/O
> exception (org.apache.hc.core5.http.NoHttpResponseException) caught
> when
> processing request to {s}->https://localhost:8112
> 2019-07-22 12:22:57,709 [https-jsse-nio-8443-exec-2] INFO :
> Recoverable I/O
> exception (org.apache.hc.core5.http.NoHttpResponseException) caught
> when
> processing request to {s}->https://localhost:8112
> 2019-07-22 12:22:57,719 [https-jsse-nio-8443-exec-2] INFO :
> Recoverable I/O
> exception (org.apache.hc.core5.http.NoHttpResponseException) caught
> when
> processing request to {s}->https://localhost:8112
> 2019-07-22 12:22:57,732 [https-jsse-nio-8443-exec-2] ERROR:
> localhost:8112
> failed to respond
> org.apache.hc.core5.http.NoHttpResponseException: localhost:8112
> failed to
> respond
> at
> org.apache.hc.core5.http.impl.io.DefaultHttpResponseParser.createConn
> ectionClosedException(DefaultHttpResponseParser.java:87)
> at
> org.apache.hc.core5.http.impl.io.AbstractMessageParser.parse(Abstract
> MessageParser.java:243)
> at
> org.apache.hc.core5.http.impl.io.AbstractMessageParser.parse(Abstract
> MessageParser.java:53)
> at
> org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection.receive
> ResponseHeader(DefaultBHttpClientConnection.java:187)
> at
> org.apache.hc.core5.http.impl.io.HttpRequestExecutor.execute(HttpRequ
> estExecutor.java:181)
> at
> org.apache.hc.core5.http.impl.io.HttpRequestExecutor.execute(HttpRequ
> estExecutor.java:224)
> at
> org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager
> $InternalConnectionEndpoint.execute(PoolingHttpClientConnectionManage
> r.java:596)
> at
> org.apache.hc.client5.http.impl.classic.InternalExecRuntime.execute(I
> nternalExecRuntime.java:220)
> at
> org.apache.hc.client5.http.impl.classic.MainClientExec.execute(MainCl
> ientExec.java:107)
> at
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(Exec
> ChainElement.java:51)
> at
> org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(Ex
> ecChainElement.java:57)
> at
> org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectEx
> ec.java:181)
> at
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(Exec
> ChainElement.java:51)
> at
> org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(Ex
> ecChainElement.java:57)
> at
> org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(Protocol
> Exec.java:165)
> at
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(Exec
> ChainElement.java:51)
> at
> org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(Ex
> ecChainElement.java:57)
> at
> org.apache.hc.client5.http.impl.classic.RetryExec.execute(RetryExec.j
> ava:88)
> at
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(Exec
> ChainElement.java:51)
> at
> org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(Ex
> ecChainElement.java:57)
> at
> org.apache.hc.client5.http.impl.classic.RedirectExec.execute(Redirect
> Exec.java:116)
> at
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(Exec
> ChainElement.java:51)
> at
> org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(Ex
> ecChainElement.java:57)
> at
> org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execut
> e(ContentCompressionExec.java:125)
> at
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(Exec
> ChainElement.java:51)
> at
> org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(
> InternalHttpClient.java:175)
> at
> org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(C
> loseableHttpClient.java:77)
> at
> com.nemesis.console.backend.storefront.DefaultRestAuthenticationProvi
> der.authenticate(DefaultRestAuthenticationProvider.java:116)
> ===
> 
>  - If I change the URL from 
> https://localhost:8112/storefront/rest/auth to
> https://some-website-with-valid-certificate.com/ it all works fine.
>  - If I change the Tomcat server to work with HTTP1.1 it all works
> fine.
>  Here is my code:
> ===
> 
> try {
> // 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 {
> return true;
> }
> 
> }).build();
> 
> int timeout = 5;
> 
> RequestConfig config =
> RequestConfig.custom().setResponseTimeout(timeout,
> TimeUnit.SECONDS).setConnectTimeout(timeout,
> TimeUnit.SECONDS).build();
> 
> // Allow TLSv1.2 protoc