0

JVM全体ではなく、接続ごとにこのようなことを行う方法はありますか?

System.setProperty("https.protocols", "TLSv1");

このようなエラーが発生し、別の投稿で上記が解決策として示されています。

javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source)
    at sun.security.ssl.AppOutputStream.write(Unknown Source)
    at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
    at java.io.BufferedOutputStream.flush(Unknown Source)
    at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:827)
    at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1975)
    at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
    at com.pilotfish.eip.modules.http.HttpPostTransport$2.run(HttpPostTransport.java:233)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
    at sun.security.ssl.InputRecord.read(Unknown Source)
    ... 15 more

JVM を介して実行されるすべてのものに適用したくはありません。1 つのクラスの 1 つのメソッド内の 1 つの特定の呼び出しだけです。

これは可能ですか?

私はJavaを使用して、Apache Commonsでv3.0.1 HttpClientを使用してWebサービスに接続しています-次のようなことをしています:

import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.HeadMethod;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.PostMethod;

...

PostMethod post = new PostMethod(getURI(data.getAttributes(), targetUri));

...

HttpClient httpclient = new HttpClient();

...

int result = httpclient.executeMethod(post);
4

0 に答える 0