问题
I have this Codesnippet:
schemeRegistry.register(new Scheme("https", factory, 443));
It says that the constructor for Scheme is deprecated, but I honestly didn't really understand which new method to use instead. Can someone show me a brief example on how to use it properly?
the complete Code in which it is used looks like this:
org.apache.http.conn.ssl.SSLSocketFactory factory = new org.apache.http.conn.ssl.SSLSocketFactory(clientStore, p12Password, trustStore);
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("https", factory2, 443));
DefaultHttpClient httpClient = new DefaultHttpClient(new ThreadSafeClientConnManager(httpParams,schemeRegistry), httpParams);
Yes, the "new ThreadSafeClientConnManager(httpParams,schemeRegistry)" is also deprecated and I may open another Question for it, but it would be good to get started with the Scheme thing, to fix everything step by step.
Regards and thanks for answers PS: First Question here, I have been a silent reader most of the time, I of course look forward to advices on how to ask questions in the next time, still don't be too harsh please.
回答1:
As stated in the documentation, you should use this constructor instead:
Scheme(String name, int port, SchemeSocketFactory factory)
来源:https://stackoverflow.com/questions/21286181/deprecated-org-apache-http-conn-scheme-scheme-is-deprecated