Detail Descriptioin:
1. When I use the same code to access "http://www.google.com", it
works.
2. When I use the same code to access "https://www.google.com", it
doesn't work and will throw IllegalArgumentException.
Please help me to identify the issue, thank you!
Here is the code fragment:
...
DefaultHttpClient httpClient = new DefaultHttpClient();
httpClient.getCredentialsProvider().setCredentials(
new AuthScope("<proxy host>", <proxy port>),
null);
HttpHost proxy = new HttpHost("<proxy host>", <proxy port>);
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
proxy);
HttpGet httpGet = new HttpGet("https://www.google.com");
try {
HttpResponse resp = httpClient.execute(httpGet);
System.out.println(resp.getStatusLine().toString());
} catch(Exception e) {
e.printStackTrace();
}
...
Here is the exception thrown:
java.lang.IllegalArgumentException
at java.net.InetSocketAddress.<init>(InetSocketAddress.java:103)
at java.net.InetSocketAddress.<init>(InetSocketAddress.java:94)
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.<init>
(OpenSSLSocketImpl.java:261)
at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImplWrapper.<init>
(OpenSSLSocketImplWrapper.java:34)
at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketFactoryImpl.createSocket
(OpenSSLSocketFactoryImpl.java:83)
at org.apache.http.conn.ssl.SSLSocketFactory.createSocket
(SSLSocketFactory.java:362)
at
org.apache.http.impl.conn.DefaultClientConnectionOperator.updateSecureConnection
(DefaultClientConnectionOperator.java:176)
at org.apache.http.impl.conn.AbstractPoolEntry.layerProtocol
(AbstractPoolEntry.java:302)
at
org.apache.http.impl.conn.AbstractPooledConnAdapter.layerProtocol
(AbstractPooledConnAdapter.java:146)
at
org.apache.http.impl.client.DefaultRequestDirector.establishRoute
(DefaultRequestDirector.java:623)
at org.apache.http.impl.client.DefaultRequestDirector.execute
(DefaultRequestDirector.java:352)
at org.apache.http.impl.client.AbstractHttpClient.execute
(AbstractHttpClient.java:555)
at org.apache.http.impl.client.AbstractHttpClient.execute
(AbstractHttpClient.java:487)
at org.apache.http.impl.client.AbstractHttpClient.execute
(AbstractHttpClient.java:465)
at aaron.example.mytry.TryProxy.onCreate(TryProxy.java:65)
at android.app.Instrumentation.callActivityOnCreate
(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity
(ActivityThread.java:2114)
at android.app.ActivityThread.handleLaunchActivity
(ActivityThread.java:2167)
at android.app.ActivityThread.access$1800(ActivityThread.java:112)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
1582)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3760)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:518)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:745)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:503)
at dalvik.system.NativeStart.main(Native Method)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---