微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

httpclient5 jdk8(1.8.0_292) CloseableHttpAsyncClient 收到致命警报:protocol_version 但 CloseableHttpClient 运行良好

如何解决httpclient5 jdk8(1.8.0_292) CloseableHttpAsyncClient 收到致命警报:protocol_version 但 CloseableHttpClient 运行良好

httpclient5 异步代码

HttpContext httpContext = new BasicHttpContext();
BasicCookieStore cookie = new BasicCookieStore();
httpContext.setAttribute(HttpClientContext.COOKIE_STORE,cookie);
SimpleHttpRequest request = SimpleHttpRequest.copy(new HttpPost("http://www.baidu.com"));

final SSLContext sslcontext = CipherSuitesUtil.createSslContext();
final Tlsstrategy tlsstrategy = new DefaultClientTlsstrategy(sslcontext);
final PoolingAsyncclientConnectionManager connectionManager = 
PoolingAsyncclientConnectionManagerBuilder
    .create()
    .setTlsstrategy(tlsstrategy)
    .build();

IOReactorConfig ioConfig = IOReactorConfig.custom()
    .setSoKeepAlive(true)
    .setSoTimeout(Timeout.ofMilliseconds(5000))
    .setIoThreadCount(4)
    .setSelectInterval(TimeValue.ofMilliseconds(500))
    .build();

RequestConfig requestConfig = RequestConfig.custom()
    .setCookieSpec(StandardCookieSpec.RELAXED)
    .setConnectTimeout(Timeout.ofMilliseconds(5000))
    .setResponseTimeout(Timeout.ofMilliseconds(5000))
    .setRedirectsEnabled(true)
    .setMaxRedirects(10)
    .build();

HttpAsyncclientBuilder clientBuilder = HttpAsyncclients.custom()
    .setDefaultRequestConfig(requestConfig)
    .setRedirectStrategy(CustomredirectStrategy.INSTANCE)
    .setConnectionManager(connectionManager)
    .setVersionPolicy(HttpVersionPolicy.FORCE_HTTP_1)
    .setIOReactorConfig(ioConfig);

CloseableHttpAsyncclient client = clientBuilder.build();

client.start();

client.execute(request,httpContext,new FutureCallback<SimpleHttpResponse>() {
    @Override
    public void completed(SimpleHttpResponse result) {
        System.out.println(result.getCode());
    }

    @Override
    public void Failed(Exception ex) {
        ex.printstacktrace();
        logger.info("{}",httpContext.getProtocolVersion());
    }

    @Override
    public void cancelled() {
        System.out.println("cancelled");
    }
});

http5 异步日志:

2021-04-29 16:01:07.688 DEBUG   --- [           main] .c.h.i.a.InternalAbstractHttpAsyncclient : ex-00000001: preparing request execution
2021-04-29 16:01:08.015 DEBUG   --- [ient-dispatch-2] org.apache.hc.client5.http.wire          : c-0000000001 >> "User-Agent: Aliyun-PTS-Async/5.0.3 (Java/1.8.0_292)[\r][\n]"
2021-04-29 16:01:07.700 DEBUG   --- [           main] o.a.h.c.http.protocol.RequestAddCookies  : Cookie spec selected: relaxed
2021-04-29 16:01:07.706 DEBUG   --- [           main] o.a.h.c.http.protocol.RequestAuthCache   : Auth cache not set in the context
2021-04-29 16:01:07.706 DEBUG   --- [           main] o.a.h.c.h.impl.async.AsyncProtocolExec   : ex-00000001: target auth state: UNCHALLENGED
2021-04-29 16:01:07.707 DEBUG   --- [           main] o.a.h.c.h.impl.async.AsyncProtocolExec   : ex-00000001: proxy auth state: UNCHALLENGED
2021-04-29 16:01:07.708 DEBUG   --- [           main] o.a.h.c.h.impl.async.AsyncConnectExec    : ex-00000001: acquiring connection with route {}->http://www.baidu.com:80
2021-04-29 16:01:07.709 DEBUG   --- [           main] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ex-00000001: acquiring endpoint (3 MINUTES)
2021-04-29 16:01:07.710 DEBUG   --- [           main] .i.n.PoolingAsyncclientConnectionManager : ex-00000001: endpoint lease request (3 MINUTES) [route: {}->http://www.baidu.com:80][total available: 0; route allocated: 0 of 5; total allocated: 0 of 25]
2021-04-29 16:01:07.715 DEBUG   --- [           main] .i.n.PoolingAsyncclientConnectionManager : ex-00000001: endpoint leased [route: {}->http://www.baidu.com:80][total available: 0; route allocated: 1 of 5; total allocated: 1 of 25]
2021-04-29 16:01:07.716 DEBUG   --- [           main] .i.n.PoolingAsyncclientConnectionManager : ex-00000001: acquired ep-00000000
2021-04-29 16:01:07.716 DEBUG   --- [           main] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ex-00000001: acquired endpoint ep-00000000
2021-04-29 16:01:07.717 DEBUG   --- [           main] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ep-00000000: connecting endpoint (5000 MILLISECONDS)
2021-04-29 16:01:07.717 DEBUG   --- [           main] .i.n.PoolingAsyncclientConnectionManager : ep-00000000: connecting endpoint to http://www.baidu.com:80 (5000 MILLISECONDS)
2021-04-29 16:01:07.718 DEBUG   --- [           main] .a.h.c.h.i.n.MultihomeIOSessionRequester : http://www.baidu.com:80: resolving remote address
2021-04-29 16:01:07.720 DEBUG   --- [           main] .a.h.c.h.i.n.MultihomeIOSessionRequester : http://www.baidu.com:80: resolved to [www.baidu.com/180.101.49.11,www.baidu.com/180.101.49.12]
2021-04-29 16:01:07.721 DEBUG   --- [           main] .a.h.c.h.i.n.MultihomeIOSessionRequester : http://www.baidu.com:80: connecting null to www.baidu.com/180.101.49.11:80 (5000 MILLISECONDS)
2021-04-29 16:01:07.794 DEBUG   --- [ient-dispatch-1] .a.h.c.h.i.n.MultihomeIOSessionRequester : http://www.baidu.com:80: connected c-0000000000 /30.225.16.84:52320->www.baidu.com/180.101.49.11:80
2021-04-29 16:01:07.795 DEBUG   --- [ient-dispatch-1] .i.n.PoolingAsyncclientConnectionManager : ep-00000000: connected c-0000000000
2021-04-29 16:01:07.795 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ep-00000000: endpoint connected
2021-04-29 16:01:07.795 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.impl.async.AsyncConnectExec    : ex-00000001: connected to target
2021-04-29 16:01:07.795 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.impl.async.AsyncConnectExec    : ex-00000001: route fully established
2021-04-29 16:01:07.796 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.i.a.HttpAsyncMainClientExec    : ex-00000001: executing POST / HTTP/1.1
2021-04-29 16:01:07.798 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ep-00000000: start execution ex-00000001
2021-04-29 16:01:07.798 DEBUG   --- [ient-dispatch-1] .i.n.PoolingAsyncclientConnectionManager : ep-00000000: executing exchange ex-00000001 over c-0000000000
2021-04-29 16:01:07.800 DEBUG   --- [ient-dispatch-1] .i.n.DefaultManagedAsyncclientConnection : c-0000000000: RequestExecutionCommand with norMAL priority
2021-04-29 16:01:07.800 DEBUG   --- [ient-dispatch-1] o.apache.hc.core5.reactor.IOSessionImpl  : c-0000000000[ACTIVE][rwc:c] Enqueued RequestExecutionCommand with priority IMMEDIATE
2021-04-29 16:01:07.801 DEBUG   --- [ient-dispatch-1] o.apache.hc.core5.reactor.IOSessionImpl  : c-0000000000 c-0000000000[ACTIVE][rw:c]: Event cleared [c]
2021-04-29 16:01:07.813 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.i.a.HttpAsyncMainClientExec    : ex-00000001: send request POST / HTTP/1.1,null entity
2021-04-29 16:01:07.814 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 >> POST / HTTP/1.1
2021-04-29 16:01:07.814 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 >> Host: www.baidu.com
2021-04-29 16:01:07.814 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 >> Connection: keep-alive
2021-04-29 16:01:07.816 DEBUG   --- [ient-dispatch-1] o.apache.hc.core5.reactor.IOSessionImpl  : c-0000000000 c-0000000000[ACTIVE][rw:c]: 117 bytes written
2021-04-29 16:01:07.816 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 >> "POST / HTTP/1.1[\r][\n]"
2021-04-29 16:01:07.816 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 >> "Host: www.baidu.com[\r][\n]"
2021-04-29 16:01:07.816 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 >> "Connection: keep-alive[\r][\n]"
2021-04-29 16:01:07.816 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 >> "[\r][\n]"
2021-04-29 16:01:07.816 DEBUG   --- [ient-dispatch-1] o.apache.hc.core5.reactor.IOSessionImpl  : c-0000000000 c-0000000000[ACTIVE][rw:c]: Event set [w]
2021-04-29 16:01:07.817 DEBUG   --- [ient-dispatch-1] o.apache.hc.core5.reactor.IOSessionImpl  : c-0000000000 c-0000000000[ACTIVE][r:c]: Event cleared [w]
2021-04-29 16:01:07.830 DEBUG   --- [ient-dispatch-1] o.apache.hc.core5.reactor.IOSessionImpl  : c-0000000000 c-0000000000[ACTIVE][r:r]: 482 bytes read
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "HTTP/1.1 302 Found[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "Bdpagetype: 3[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "Connection: keep-alive[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "Content-Length: 154[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "Content-Type: text/html[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "Date: Thu,29 Apr 2021 08:01:07 GMT[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "Location: https://www.baidu.com/search/error.html[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "Server: BWS/1.1[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "Set-Cookie: BDSVRTM=0; path=/[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "Traceid: 161968326706131343469958385445872604417[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "X-Ua-Compatible: IE=Edge,chrome=1[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "<html>[\r][\n]"
2021-04-29 16:01:07.831 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "<head><title>302 Found</title></head>[\r][\n]"
2021-04-29 16:01:07.832 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "<body bgcolor="white">[\r][\n]"
2021-04-29 16:01:07.832 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "<center><h1>302 Found</h1></center>[\r][\n]"
2021-04-29 16:01:07.832 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "<hr><center>Nginx</center>[\r][\n]"
2021-04-29 16:01:07.832 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "</body>[\r][\n]"
2021-04-29 16:01:07.832 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.wire          : c-0000000000 << "</html>[\r][\n]"
2021-04-29 16:01:07.835 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 << HTTP/1.1 302 Found
2021-04-29 16:01:07.835 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 << Bdpagetype: 3
2021-04-29 16:01:07.836 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 << Connection: keep-alive
2021-04-29 16:01:07.836 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 << Content-Length: 154
2021-04-29 16:01:07.836 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 << Content-Type: text/html
2021-04-29 16:01:07.836 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 << Date: Thu,29 Apr 2021 08:01:07 GMT
2021-04-29 16:01:07.836 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 << Location: https://www.baidu.com/search/error.html
2021-04-29 16:01:07.836 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 << Server: BWS/1.1
2021-04-29 16:01:07.836 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 << Set-Cookie: BDSVRTM=0; path=/
2021-04-29 16:01:07.836 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 << Traceid: 161968326706131343469958385445872604417
2021-04-29 16:01:07.836 DEBUG   --- [ient-dispatch-1] org.apache.hc.client5.http.headers       : c-0000000000 << X-Ua-Compatible: IE=Edge,chrome=1
2021-04-29 16:01:07.837 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.i.a.HttpAsyncMainClientExec    : ex-00000001: consume response HTTP/1.1 302 Found,entity len 154
2021-04-29 16:01:07.838 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.p.ResponseProcessCookies       : Cookie accepted [BDSVRTM="0",domain:www.baidu.com,path:/,expiry:null]
2021-04-29 16:01:07.841 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.impl.async.AsyncRedirectExec   : ex-00000001: redirect requested to location 'https://www.baidu.com/search/error.html'
2021-04-29 16:01:07.842 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.impl.async.AsyncRedirectExec   : ex-00000001: resetting target auth state
2021-04-29 16:01:07.842 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.impl.async.AsyncRedirectExec   : ex-00000001: redirecting to 'https://www.baidu.com/search/error.html' via {}->http://www.baidu.com:80
2021-04-29 16:01:07.844 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.i.a.HttpAsyncMainClientExec    : ex-00000001: consume response data,len 154 bytes
2021-04-29 16:01:07.844 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.i.a.HttpAsyncMainClientExec    : ex-00000001: end of response data
2021-04-29 16:01:07.844 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ep-00000000: releasing valid endpoint
2021-04-29 16:01:07.844 DEBUG   --- [ient-dispatch-1] .i.n.PoolingAsyncclientConnectionManager : ep-00000000: releasing endpoint
2021-04-29 16:01:07.844 DEBUG   --- [ient-dispatch-1] .i.n.PoolingAsyncclientConnectionManager : ep-00000000: connection c-0000000000 can be kept alive for 3 MINUTES
2021-04-29 16:01:07.845 DEBUG   --- [ient-dispatch-1] .i.n.PoolingAsyncclientConnectionManager : ep-00000000: connection released [route: {}->http://www.baidu.com:80][total available: 1; route allocated: 1 of 5; total allocated: 1 of 25]
2021-04-29 16:01:07.845 DEBUG   --- [ient-dispatch-1] o.a.h.c.http.protocol.RequestAddCookies  : Cookie spec selected: relaxed
2021-04-29 16:01:07.851 DEBUG   --- [ient-dispatch-1] o.a.h.c.http.protocol.RequestAddCookies  : Cookie [name: BDSVRTM; value: 0; domain: www.baidu.com; path: /; expiry: null] match [(secure)www.baidu.com:443/search/error.html]
2021-04-29 16:01:07.851 DEBUG   --- [ient-dispatch-1] o.a.h.c.http.protocol.RequestAuthCache   : Auth cache not set in the context
2021-04-29 16:01:07.851 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.impl.async.AsyncProtocolExec   : ex-00000001: target auth state: UNCHALLENGED
2021-04-29 16:01:07.851 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.impl.async.AsyncProtocolExec   : ex-00000001: proxy auth state: UNCHALLENGED
2021-04-29 16:01:07.851 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.impl.async.AsyncConnectExec    : ex-00000001: acquiring connection with route {s}->https://www.baidu.com:443
2021-04-29 16:01:07.851 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ex-00000001: acquiring endpoint (3 MINUTES)
2021-04-29 16:01:07.852 DEBUG   --- [ient-dispatch-1] .i.n.PoolingAsyncclientConnectionManager : ex-00000001: endpoint lease request (3 MINUTES) [route: {s}->https://www.baidu.com:443][total available: 1; route allocated: 0 of 5; total allocated: 1 of 25]
2021-04-29 16:01:07.852 DEBUG   --- [ient-dispatch-1] .i.n.PoolingAsyncclientConnectionManager : ex-00000001: endpoint leased [route: {s}->https://www.baidu.com:443][total available: 1; route allocated: 1 of 5; total allocated: 2 of 25]
2021-04-29 16:01:07.852 DEBUG   --- [ient-dispatch-1] .i.n.PoolingAsyncclientConnectionManager : ex-00000001: acquired ep-00000001
2021-04-29 16:01:07.852 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ex-00000001: acquired endpoint ep-00000001

2021-04-29 16:01:07.852 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ep-00000001: connecting endpoint (5000 MILLISECONDS)
2021-04-29 16:01:07.852 DEBUG   --- [ient-dispatch-1] .i.n.PoolingAsyncclientConnectionManager : ep-00000001: connecting endpoint to https://www.baidu.com:443 (5000 MILLISECONDS)
2021-04-29 16:01:07.852 DEBUG   --- [ient-dispatch-1] .a.h.c.h.i.n.MultihomeIOSessionRequester : https://www.baidu.com:443: resolving remote address
2021-04-29 16:01:07.853 DEBUG   --- [ient-dispatch-1] .a.h.c.h.i.n.MultihomeIOSessionRequester : https://www.baidu.com:443: resolved to [www.baidu.com/180.101.49.11,www.baidu.com/180.101.49.12]
2021-04-29 16:01:07.853 DEBUG   --- [ient-dispatch-1] .a.h.c.h.i.n.MultihomeIOSessionRequester : https://www.baidu.com:443: connecting null to www.baidu.com/180.101.49.11:443 (5000 MILLISECONDS)
2021-04-29 16:01:07.853 DEBUG   --- [ient-dispatch-1] o.apache.hc.core5.reactor.IOSessionImpl  : c-0000000000 c-0000000000[ACTIVE][r:r]: Event set [r]
2021-04-29 16:01:07.853 DEBUG   --- [ient-dispatch-1] o.a.h.c.h.i.a.InternalHttpAsyncclient    : c-0000000000 Connection is kept alive
2021-04-29 16:01:07.868 DEBUG   --- [ient-dispatch-2] .a.h.c.h.i.n.MultihomeIOSessionRequester : https://www.baidu.com:443: connected c-0000000001 /30.225.16.84:52321->www.baidu.com/180.101.49.11:443
2021-04-29 16:01:07.869 DEBUG   --- [ient-dispatch-2] .i.n.DefaultManagedAsyncclientConnection : c-0000000001: start TLS
2021-04-29 16:01:07.881 DEBUG   --- [ient-dispatch-2] .i.n.PoolingAsyncclientConnectionManager : ep-00000001: connected c-0000000001
2021-04-29 16:01:07.881 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ep-00000001: endpoint connected
2021-04-29 16:01:07.881 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.impl.async.AsyncConnectExec    : ex-00000001: connected to target
2021-04-29 16:01:07.882 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.impl.async.AsyncConnectExec    : ex-00000001: route fully established
2021-04-29 16:01:07.882 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.i.a.HttpAsyncMainClientExec    : ex-00000001: executing GET /search/error.html HTTP/1.1
2021-04-29 16:01:07.882 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ep-00000001: start execution ex-00000001
2021-04-29 16:01:07.882 DEBUG   --- [ient-dispatch-2] .i.n.PoolingAsyncclientConnectionManager : ep-00000001: executing exchange ex-00000001 over c-0000000001
2021-04-29 16:01:07.882 DEBUG   --- [ient-dispatch-2] .i.n.DefaultManagedAsyncclientConnection : c-0000000001: RequestExecutionCommand with norMAL priority
2021-04-29 16:01:07.883 DEBUG   --- [ient-dispatch-2] o.a.hc.core5.reactor.ssl.SSLIOSession    : c-0000000001[ACTIVE][rwc:c][ACTIVE][rw][NOT_HANDSHAKING][0][0][0] Enqueued RequestExecutionCommand with priority IMMEDIATE
2021-04-29 16:01:07.883 DEBUG   --- [ient-dispatch-2] o.a.hc.core5.reactor.ssl.SSLIOSession    : c-0000000001 c-0000000001[ACTIVE][rw:c][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]: Event cleared [c]
2021-04-29 16:01:07.886 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.ssl.AbstractClientTlsstrategy  : Enabled protocols: [TLSv1.2]
2021-04-29 16:01:07.886 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.ssl.AbstractClientTlsstrategy  : Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_DSS_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_DSS_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384,TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_DSS_WITH_AES_256_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDH_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_DSS_WITH_AES_128_CBC_SHA,TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2021-04-29 16:01:08.009 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.ssl.AbstractClientTlsstrategy  : Secure session established
2021-04-29 16:01:08.009 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.ssl.AbstractClientTlsstrategy  :  negotiated protocol: TLSv1.2
2021-04-29 16:01:08.010 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.ssl.AbstractClientTlsstrategy  :  negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
2021-04-29 16:01:08.010 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.ssl.AbstractClientTlsstrategy  :  peer principal: CN=baidu.com,O="Beijing Baidu Netcom Science Technology Co.,Ltd",OU=service operation department,L=beijing,ST=beijing,C=CN
2021-04-29 16:01:08.010 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.ssl.AbstractClientTlsstrategy  :  peer alternative names: [baidu.com,baifubao.com,www.baidu.cn,www.baidu.com.cn,mct.y.nuomi.com,apollo.auto,dwz.cn,*.baidu.com,*.baifubao.com,*.baidustatic.com,*.bdstatic.com,*.bdimg.com,*.hao123.com,*.nuomi.com,*.chuanke.com,*.trustgo.com,*.bce.baidu.com,*.eyun.baidu.com,*.map.baidu.com,*.mbd.baidu.com,*.fanyi.baidu.com,*.baidubce.com,*.mipcdn.com,*.news.baidu.com,*.baidupcs.com,*.aipage.com,*.aipage.cn,*.bcehost.com,*.safe.baidu.com,*.im.baidu.com,*.baiducontent.com,*.dlnel.com,*.dlnel.org,*.dueros.baidu.com,*.su.baidu.com,*.91.com,*.hao123.baidu.com,*.apollo.auto,*.xueshu.baidu.com,*.bj.baidubce.com,*.gz.baidubce.com,*.smartapps.cn,*.bdtjrcv.com,*.hao222.com,*.haokan.com,*.pae.baidu.com,*.vd.bdstatic.com,click.hm.baidu.com,log.hm.baidu.com,cm.pos.baidu.com,wn.pos.baidu.com,update.pan.baidu.com]
2021-04-29 16:01:08.010 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.ssl.AbstractClientTlsstrategy  :  issuer principal: CN=GlobalSign Organization Validation CA - SHA256 - G2,O=GlobalSign nv-sa,C=BE
2021-04-29 16:01:08.013 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.i.a.HttpAsyncMainClientExec    : ex-00000001: send request GET /search/error.html HTTP/1.1,null entity
2021-04-29 16:01:08.014 DEBUG   --- [ient-dispatch-2] org.apache.hc.client5.http.headers       : c-0000000001 >> GET /search/error.html HTTP/1.1
2021-04-29 16:01:08.014 DEBUG   --- [ient-dispatch-2] org.apache.hc.client5.http.headers       : c-0000000001 >> Cookie: BDSVRTM=0
2021-04-29 16:01:08.014 DEBUG   --- [ient-dispatch-2] org.apache.hc.client5.http.headers       : c-0000000001 >> Host: www.baidu.com
2021-04-29 16:01:08.014 DEBUG   --- [ient-dispatch-2] org.apache.hc.client5.http.headers       : c-0000000001 >> Connection: keep-alive
2021-04-29 16:01:08.014 DEBUG   --- [ient-dispatch-2] o.a.hc.core5.reactor.ssl.SSLIOSession    : c-0000000001 c-0000000001[ACTIVE][r:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]: 152 bytes written
2021-04-29 16:01:08.014 DEBUG   --- [ient-dispatch-2] org.apache.hc.client5.http.wire          : c-0000000001 >> "GET /search/error.html HTTP/1.1[\r][\n]"
2021-04-29 16:01:08.015 DEBUG   --- [ient-dispatch-2] org.apache.hc.client5.http.wire          : c-0000000001 >> "Cookie: BDSVRTM=0[\r][\n]"
2021-04-29 16:01:08.015 DEBUG   --- [ient-dispatch-2] org.apache.hc.client5.http.wire          : c-0000000001 >> "Host: www.baidu.com[\r][\n]"
2021-04-29 16:01:08.015 DEBUG   --- [ient-dispatch-2] org.apache.hc.client5.http.wire          : c-0000000001 >> "Connection: keep-alive[\r][\n]"
2021-04-29 16:01:08.015 DEBUG   --- [ient-dispatch-2] org.apache.hc.client5.http.wire          : c-0000000001 >> "[\r][\n]"
2021-04-29 16:01:08.015 DEBUG   --- [ient-dispatch-2] o.a.hc.core5.reactor.ssl.SSLIOSession    : c-0000000001 c-0000000001[ACTIVE][rw:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]: Event set [w]
2021-04-29 16:01:08.015 DEBUG   --- [ient-dispatch-2] o.a.hc.core5.reactor.ssl.SSLIOSession    : c-0000000001 c-0000000001[ACTIVE][r:r][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event cleared [w]
2021-04-29 16:01:08.034 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.i.a.HttpAsyncMainClientExec    : ex-00000001: execution Failed: Received fatal alert: protocol_version
2021-04-29 16:01:08.034 DEBUG   --- [ient-dispatch-2] .c.h.i.a.InternalAbstractHttpAsyncclient : ex-00000001: request Failed: Received fatal alert: protocol_version
2021-04-29 16:01:08.034 DEBUG   --- [ient-dispatch-2] .i.n.PoolingAsyncclientConnectionManager : ep-00000001: close IMMEDIATE
2021-04-29 16:01:08.034 DEBUG   --- [ient-dispatch-2] .i.n.DefaultManagedAsyncclientConnection : c-0000000001: Shutdown connection IMMEDIATE
2021-04-29 16:01:08.035 DEBUG   --- [ient-dispatch-2] o.a.hc.core5.reactor.ssl.SSLIOSession    : c-0000000001 c-0000000001[CLOSED][][CLOSED][r][NOT_HANDSHAKING][inbound done][][outbound done][][31][0][0]: Close IMMEDIATE
2021-04-29 16:01:08.035 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ep-00000001: endpoint closed
2021-04-29 16:01:08.035 DEBUG   --- [ient-dispatch-2] o.a.h.c.h.i.a.InternalHttpAsyncclient    : ep-00000001: discarding endpoint
2021-04-29 16:01:08.035 DEBUG   --- [ient-dispatch-2] .i.n.PoolingAsyncclientConnectionManager : ep-00000001: releasing endpoint
2021-04-29 16:01:08.035 DEBUG   --- [ient-dispatch-2] .i.n.PoolingAsyncclientConnectionManager : ep-00000001: connection released [route: {s}->https://www.baidu.com:443][total available: 1; route allocated: 0 of 5; total allocated: 1 of 25]
2021-04-29 16:01:08.036  INFO   --- [ient-dispatch-2] c.t.a.allspark.agent.util.HttpUtilTest   : HTTP/1.1
2021-04-29 16:01:08.036 DEBUG   --- [ient-dispatch-2] o.a.hc.core5.reactor.ssl.SSLIOSession    : c-0000000001 c-0000000001[CLOSED][][CLOSED][r][NOT_HANDSHAKING][inbound done][][outbound done][][31][0][0]: Close IMMEDIATE
javax.net.ssl.SSLHandshakeException: Received fatal alert: protocol_version
    at sun.security.ssl.Alert.createSSLException(Alert.java:131)
    at sun.security.ssl.Alert.createSSLException(Alert.java:117)
    at sun.security.ssl.TransportContext.fatal(TransportContext.java:311)
    at sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:293)
    at sun.security.ssl.TransportContext.dispatch(TransportContext.java:185)
    at sun.security.ssl.SSLTransport.decode(SSLTransport.java:152)
    at sun.security.ssl.SSLEngineImpl.decode(SSLEngineImpl.java:575)
    at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:531)
    at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:398)
    at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:377)
    at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:626)
    at org.apache.hc.core5.reactor.ssl.SSLIOSession.doUnwrap(SSLIOSession.java:288)
    at org.apache.hc.core5.reactor.ssl.SSLIOSession.decryptData(SSLIOSession.java:543)
    at org.apache.hc.core5.reactor.ssl.SSLIOSession.access$400(SSLIOSession.java:72)
    at org.apache.hc.core5.reactor.ssl.SSLIOSession$1.inputReady(SSLIOSession.java:172)
    at org.apache.hc.core5.reactor.InternalDataChannel.onIOEvent(InternalDataChannel.java:131)
    at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)
    at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:179)
    at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:128)
    at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:85)
    at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
    at java.lang.Thread.run(Thread.java:748)

我试过 Apache HTTP Client 5.0 HTTP/2 POST Example needed 这个,将 jdk8 升级到 jdk8(1.8.0_292),然后安装 jce,但还是不行。真的需要帮助。

我也检查了这个,似乎 TLSV1.2 和 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 没问题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?