HttpsURLConnection是否支持IPv6?

时间:2014-05-20 03:54:32

标签: java android httpsurlconnection

我无法通过HttpsURLConnection连接到IPv6服务器,getInputStream()在我发送请求时返回null。

我没有找到任何有用的信息:Android开发人员指南说HttpURLConnection可以透明支持IPv6,但是没有提到HttpsURLConnection可以支持IPv6与否。有没有人有这方面的经验?

更新 - 1:

在服务器端,我发现连接失败时出现错误日志:

[error] Hostname [xxxx:xxxx:x:xx::xxx] provided via SNI and 
        hostname xxxx:xxxx:x:xx::xxx provided via HTTP are different

要连接到同一个IPv6 Apache服务器(版本2.2.27),Apache HttpClient可以正常工作,但HttpsURLConnection不会。所以它可能不是服务器端问题。有没有人在使用HttpsURLConnection之前看到此错误?

1 个答案:

答案 0 :(得分:0)

Java 支持IPv6,已经做了很多年。 HttpsURLConnection支持Java支持的任何内容。

您可能还注意到HttpsURLConnection扩展了HttpURLConnection.