내가 HTTP 통화를 할 안드로이드 쿼리를 사용하고, 나는 다음과 같은 임의 SSLExceptions가 계속 :안드로이드 쿼리 - 랜덤 SSLExceptions
자신의 발생에 어떠한 이유도 까닭도 없을 것 같다AQuery(7746): javax.net.ssl.SSLException: Read error: ssl=0x19d3c0: I/O error during system call, Connection reset by peer
AQuery(7746): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_read(Native Method)
AQuery(7746): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:801)
AQuery(7746): at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103)
AQuery(7746): at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:191)
AQuery(7746): at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:82)
AQuery(7746): at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
AQuery(7746): at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:180)
AQuery(7746): at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:235)
AQuery(7746): at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
AQuery(7746): at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:279)
AQuery(7746): at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
AQuery(7746): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:428)
AQuery(7746): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
AQuery(7746): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
AQuery(7746): at com.androidquery.callback.AbstractAjaxCallback.httpDo(AbstractAjaxCallback.java:1328)
AQuery(7746): at com.androidquery.callback.AbstractAjaxCallback.httpGet(AbstractAjaxCallback.java:1207)
AQuery(7746): at com.androidquery.callback.AbstractAjaxCallback.network(AbstractAjaxCallback.java:1133)
AQuery(7746): at com.androidquery.callback.AbstractAjaxCallback.networkWork(AbstractAjaxCallback.java:986)
AQuery(7746): at com.androidquery.callback.AbstractAjaxCallback.backgroundWork(AbstractAjaxCallback.java:933)
AQuery(7746): at com.androidquery.callback.AbstractAjaxCallback.run(AbstractAjaxCallback.java:894)
AQuery(7746): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
AQuery(7746): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
AQuery(7746): at java.lang.Thread.run(Thread.java:1020)
. 아마 내가 전화를 걸면 1/6 정도 걸릴거야.
// 응용 CREATE :
public void onCreate()
{
AQUtility.setExceptionHandler(new UncaughtExceptionHandler() {
public void uncaughtException(Thread thread, Throwable ex)
{
ex.printStackTrace();
}
});
AQUtility.setDebug(true);
AjaxCallback.setTransformer(new JsonTransformer());
//set the max number of concurrent network connections, default is 4
AjaxCallback.setNetworkLimit(8);
//set the max number of icons (image width <= 50) to be cached in memory, default is 20
BitmapAjaxCallback.setIconCacheLimit(20);
//set the max number of images (image width > 50) to be cached in memory, default is 20
BitmapAjaxCallback.setCacheLimit(40);
//set the max size of an image to be cached in memory, default is 1600 pixels (ie. 400x400)
BitmapAjaxCallback.setPixelLimit(480 * 480);
//set the max size of the memory cache, default is 1M pixels (4MB) (2---)
BitmapAjaxCallback.setMaxPixelLimit(4000000);
super.onCreate();
}
// 사용법 // 참고 : URI = // 07-13 여기
내가 안드로이드 쿼리 ($
)를 사용하고 어떻게 17 : 26 : 08.040 : W/AQuery (7746) 얻기 : https://site.com/me/ticker/
$.auth(Security.getAuth(this)).ajax(uri, BaseModelListRequest.class, this, "loadAdapterObjectsCallback");
public void loadAdapterObjectsCallback(String uri, BaseModelListRequest requestData, AjaxStatus status)
{
setProgressBarIndeterminateVisibility(false);
setSupportProgressBarIndeterminateVisibility(false);
if(requestData != null && status.getCode() == 200)
{
// stuff
}
}
// 여기를 GETAUTH :
,174,public static synchronized BasicHandle getAuth(Context context)
{
return new BasicHandle("user", "pass");
}
// 제품과 JSONTRANSFORMER는 (마샬 JSON으로 jaxson 사용) :
public class JsonTransformer implements Transformer
{
public <T> T transform(String url, Class<T> type, String encoding, byte[] data, AjaxStatus status)
{
ObjectMapper mapper = new ObjectMapper();
try
{
return mapper.readValue(new String(data), type);
}
catch(Exception e)
{
return null;
}
}
}
편집 :이 SSL을 사용하여, 2.X 및 3.X에 발생합니다. SSL (https -> http)을 비활성화하면 제대로 작동합니다. 여기
은 SSL과 다른 예외 : 오류 안드로이드 인 2.3.x 장치에서 발생추가 검사 수율 :
07-13 22:03:41.454: W/AQuery(2517): javax.net.ssl.SSLException: Not trusted server certificate
07-13 22:03:41.454: W/AQuery(2517): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:360)
07-13 22:03:41.454: W/AQuery(2517): at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:92)
07-13 22:03:41.454: W/AQuery(2517): at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:321)
07-13 22:03:41.454: W/AQuery(2517): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:140)
07-13 22:03:41.454: W/AQuery(2517): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
07-13 22:03:41.454: W/AQuery(2517): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
07-13 22:03:41.454: W/AQuery(2517): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
07-13 22:03:41.454: W/AQuery(2517): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
07-13 22:03:41.454: W/AQuery(2517): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
07-13 22:03:41.454: W/AQuery(2517): at com.androidquery.callback.AbstractAjaxCallback.httpDo(AbstractAjaxCallback.java:1328)
07-13 22:03:41.454: W/AQuery(2517): at com.androidquery.callback.AbstractAjaxCallback.httpGet(AbstractAjaxCallback.java:1207)
07-13 22:03:41.454: W/AQuery(2517): at com.androidquery.callback.AbstractAjaxCallback.network(AbstractAjaxCallback.java:1133)
07-13 22:03:41.454: W/AQuery(2517): at com.androidquery.callback.AbstractAjaxCallback.networkWork(AbstractAjaxCallback.java:986)
07-13 22:03:41.454: W/AQuery(2517): at com.androidquery.callback.AbstractAjaxCallback.backgroundWork(AbstractAjaxCallback.java:933)
07-13 22:03:41.454: W/AQuery(2517): at com.androidquery.callback.AbstractAjaxCallback.run(AbstractAjaxCallback.java:894)
07-13 22:03:41.454: W/AQuery(2517): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
07-13 22:03:41.454: W/AQuery(2517): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
07-13 22:03:41.454: W/AQuery(2517): at java.lang.Thread.run(Thread.java:1096)
07-13 22:03:41.454: W/AQuery(2517): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
07-13 22:03:41.454: W/AQuery(2517): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:168)
07-13 22:03:41.454: W/AQuery(2517): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:355)
07-13 22:03:41.454: W/AQuery(2517): ... 17 more
07-13 22:03:41.454: W/AQuery(2517): Caused by: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
07-13 22:03:41.454: W/AQuery(2517): at org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:149)
07-13 22:03:41.454: W/AQuery(2517): at java.security.cert.CertPathValidator.validate(CertPathValidator.java:211)
07-13 22:03:41.454: W/AQuery(2517): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:164)
07-13 22:03:41.454: W/AQuery(2517): ... 18 more
EDIT 2. 프로토콜 (예 : SSL)에서 "s"를 제거하면 모든 것이 잘 작동합니다. 내가 이전에 RestTemplate (봄 - 안드로이드)와 함께이 문제가 있고,이 게시물의 권고에 따라이를 해결 한
그러나 Self-signed SSL acceptance on Android
, 나는 같은 방식으로 안드로이드 쿼리에 소스를 수정, 그것은했다 문제를 해결하지 않습니다.
[Android HTTPS 예외 연결 재설정 가능] (http://stackoverflow.com/questions/8472556/android-https-exception-connection-reset-by-peer) –