1. 程式人生 > >java.lang.IllegalArgumentException: TLSv1.2

java.lang.IllegalArgumentException: TLSv1.2

hostname hello lar actor pcl 版本 nbsp erl build

通過HTTPClient4.5,基於JDK1.6

new SSLConnectionSocketFactory(builder.build(), new String[]{"SSLv2Hello", "SSLv3", "TLSv1", "TLSv1.2"}, null, NoopHostnameVerifier.INSTANCE);

經查詢發現:

TLSv1.2 is supported since Java 7 so not working in Java 6.

If you set TLSv1.2 to SSL socket in Java 6 then you will get the exception: improperly. java.lang.IllegalArgumentException: TLSv1.2

解決方法:

方法一:修改JDK版本,使用JDK7,8;

方法二:將參數TLSv1.2去掉。

java.lang.IllegalArgumentException: TLSv1.2