It's right cause it works !
Thx very much. This the code pour connection with proxy :
***********************************************
protected HttpURLConnection openConnection(URL url) throws IOException
{
Proxy proxy = new Proxy(Proxy.Type.HTTP, new
InetSocketAddress("URL_OF_YOUR_PROXY", PORT_OF_YOUR_PROXY));
URL my_url = new URL(url.toString());
return (HttpURLConnection) my_url.openConnection(proxy);
}
***********************************************
Anyway, if your proxy use an SSL certification, read this :
http://www.developpez.net/forums/d922760/java/general-java/apis/securite/sun-security-provider-certpath-suncertpathbuilderexception-unable-to-find-valid-certification-path-to-request/
(in french, sorry). For test you could add in your public static void
main this code (not available for production) :
***********************************************
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
// TODO Auto-generated method stub
return null;
}
@Override
public void checkServerTrusted(X509Certificate[] arg0,
String arg1) throws CertificateException {
// TODO Auto-generated method stub
}
@Override
public void checkClientTrusted(X509Certificate[] arg0,
String arg1) throws CertificateException {
// TODO Auto-generated method stub
}
}
};
// Install the all-trusting trust manager
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new
java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} catch (Exception e) {
}
***********************************************
Regards,
> Marcel St r,
http://www.frightanic.com