I tried doing PreEmptive Authentication for a Basic Auth protected Solr using this class https://subversion.jfrog.org/jfrog/build-info/trunk/build-info-client/src/main/java/org/jfrog/build/client/PreemptiveHttpClient.java and Solr , but the methods were Deprecated so I do not know if this was a problem. The situation is in querying is fine in Solr but for indexing I am getting a IOException occured when talking to server at: example.com:8983/solr/core1 .
The HttpSolrClient constructor requires an httpClient as a parameter to do preemptive authorization so with the class above since the httpClient is stored in a private variable I used a getter on that variable to get the httpClient and pass to the HttpSolrClient constructor. Not sure if I did that right either.
PreemptiveAuthenticate preemp = new PreemptiveAuthenticate("username", "password", 1);
DefaultHttpClient httpClient = preemp.getHttpClient();
System.out.println("Made it to connectSolr after set Authentication");
SolrClient solr = new HttpSolrClient(urlString, httpClient);
I am aware of examples like http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html Example 4.6 to do preemptive authorization with HttpClient 4.3 , but this is a test case and I do not see a way to pass the HttpClient so that I can do preemptive authentication.