Skip to content

Apache Lucene open-source search software

speed up test

Robert Muir76de9537b16d
diff --git a/solr/src/test/org/apache/solr/client/solrj/SolrExceptionTest.java b/solr/src/test/org/apache/solr/client/solrj/SolrExceptionTest.java
index d37d9cf0878..6b24748d1c1 100644
--- a/solr/src/test/org/apache/solr/client/solrj/SolrExceptionTest.java
+++ b/solr/src/test/org/apache/solr/client/solrj/SolrExceptionTest.java
@@ -21,6 +21,8 @@ import java.net.UnknownHostException;
import junit.framework.TestCase;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrException;
@@ -39,7 +41,10 @@ public class SolrExceptionTest extends TestCase {
boolean gotExpectedError = false;
try {
// switched to a local address to avoid going out on the net, ns lookup issues, etc.
- SolrServer client = new CommonsHttpSolrServer("http://localhost:11235/solr/");
+ // set a 1ms timeout to let the connection fail faster.
+ HttpClient httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
+ httpClient.getParams().setParameter("http.connection.timeout", new Integer(1));
+ SolrServer client = new CommonsHttpSolrServer("http://localhost:11235/solr/", httpClient);
SolrQuery query = new SolrQuery("test123");
client.query(query);
} catch (SolrServerException sse) {