나는 안드로이드에 대한 https 클라이언트를 빌드하려고하고 서블릿의 일부 요청을 받아야합니까 하지만 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();
}
이것은 전화를 확인하기위한 것이지만 작동하지 않았습니다. 이유가 무엇인지 알려주지 않는 이유는 무엇입니까?
subscribe 메서드가 작동합니다. 입력 스트림이있는 행을 주석 처리하면 서버에서 모두 올바르게 표시됩니다. 파이어 폭스에서 같은 것을 시도해 볼 수 있으며 작동하며 요청을 볼 수 있습니다.
또한 키 저장소를 TrustManager에 넣습니다.
영어로 죄송합니다. 설명해 주시면 감사하겠습니다.
THX
당신은 메인 스레드 나 다른 스레드에서이 일을하고 있는가? – Falmarri
클라이언트 측 인증서를 설치 했습니까? – Vinay