0
IAPトランザクションの領収書を検証するために使用するコードは次のとおりです。 httpsURLConnection.getOutputStream()はSocketExceptionをスローします。接続がリセットされました。 何が紛失していますか?Apple IAP - 領収書の検証方法
パブリッククラスHttpsClient企業のファイアウォールと{
public static void main(String[] args) {
HttpURLConnection.setFollowRedirects(false);
JSONObject jsonObject = new JSONObject();
jsonObject
.put("receipt-data",
"encodeReceipt");
HttpURLConnection con = null;
try {
String url = "https://buy.itunes.apple.com/verifyReceipt";
con = (HttpURLConnection) new URL(url).openConnection();
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) con;
httpsURLConnection.setDoOutput(true);
OutputStreamWriter wr = null;
wr = new OutputStreamWriter(httpsURLConnection.getOutputStream());
wr.write(jsonObject.toString());
wr.flush();
// Get the response
httpsURLConnection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(
httpsURLConnection.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
System.out.print(line);
}
rd.close();
System.out.println(httpsURLConnection);
} catch (Exception e1) {
e1.printStackTrace();
}
}
}