1

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.

Óscar López
  • 232,561
  • 37
  • 312
  • 386

1 Answers1

1

As stated in the documentation, you should use this constructor instead:

Scheme(String name, int port, SchemeSocketFactory factory)
Óscar López
  • 232,561
  • 37
  • 312
  • 386
  • Concerning the ThreadSafeClientConnManager: I am using ApacheHttpClient 4.1.2. I saw that I should use PoolingHttpClientConnectionManager instead, but this is only supported since 4.2 So I can ignore Eclipse's warning that the ThreadSafeClientConnManager is deprecated as long as I stay with 4.1.2 or 4.2, right? – Martin Moosbauer Jan 22 '14 at 15:39
  • Yes, you can ignore the warning, but I'd also suggest: consider updating to a newer version (4.3), to avoid this kind of problems ;) – Óscar López Jan 22 '14 at 15:52