rackspace/java-cloudfiles — Issue #22: login throw javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated  
Author: snowman320
Created: 2011-10-19 08:32:38+00:00
State: open

btw, i'm using a proxy. Code attached below.

final int connectionTimeOut = (int)FilesUtil.getIntProperty("connection_timeout");

DefaultHttpClient httpClient =
new DefaultHttpClient() {
protected HttpParams createHttpParams() {
BasicHttpParams params = new BasicHttpParams();
org.apache.http.params.HttpConnectionParams.setSoTimeout(params, connectionTimeOut);
params.setParameter("http.socket.timeout", connectionTimeOut);
return params;
}

@Override
protected ClientConnectionManager createClientConnectionManager() {
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(
new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
schemeRegistry.register(
new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
return new ThreadSafeClientConnManager(createHttpParams(), schemeRegistry);
}
};

HttpHost proxy = new HttpHost("XXX.XXX.XX.XX", 8080, "http");
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

FilesClient client = new FilesClient(
httpClient,
FilesUtil.getProperty("username")
FilesUtil.getProperty("password"),
null,
null,
connectionTimeOut) ;

boolean success = client.login(); // throws SSLPeerUnverifiedException