我尝试为android构建一个https客户端,我需要获得Servlet的一些请求 但是当我使用getInputStream方法时,应用程序挂起。httpsURLConnection.getInputStream()挂起
只有当我打电话给方法时,才会出现错误。
String url = "https://.../Servlet";
try {
mPushLiteConnection = (HttpsURLConnection) new URL(url).openConnection();
mPushLiteConnection.setDoOutput(true);
mPushLiteConnection.setDoInput(true);
mPushLiteConnection.setRequestMethod("POST");
mPushLiteConnection.connect();
subscribe();
InputStream in = (InputStream)mPushLiteConnection.getInputStream();
unsubscribe();
mPushLiteConnection.disconnect();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
这只是检查呼叫,但它没有工作。 任何想法为什么它挂起,并告诉我什么?
订阅方法的作品,当我注释输入流的行,服务器显示我都是正确的。 我可以尝试与Firefox一样,它的工作原理,我可以看到请求。
我还将密钥库放入TrustManager中。
对不起,我的英语我希望我解释它ennougth。
THX
你的主线程或不同线程上这样做呢? – Falmarri 2010-08-16 18:33:45
您是否在客户端安装了证书? – Vinay 2010-08-17 06:46:04