METRON-1870 Intermittent Stellar REST test failures (merrimanr via nickwallen) closes apache/metron#1263
diff --git a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/dsl/functions/RestFunctions.java b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/dsl/functions/RestFunctions.java
index 7134bfc..354322a 100644
--- a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/dsl/functions/RestFunctions.java
+++ b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/dsl/functions/RestFunctions.java
@@ -223,14 +223,14 @@
      * @return
      * @throws IOException
      */
-    private Object doGet(RestConfig restConfig, HttpGet httpGet, HttpClientContext httpClientContext) throws IOException {
+    protected Object doGet(RestConfig restConfig, HttpGet httpGet, HttpClientContext httpClientContext) throws IOException {
 
       // Schedule a command to abort the httpGet request if the timeout is exceeded
       ScheduledFuture scheduledFuture = scheduledExecutorService.schedule(httpGet::abort, restConfig.getTimeout(), TimeUnit.MILLISECONDS);
       CloseableHttpResponse response;
       try {
         response = httpClient.execute(httpGet, httpClientContext);
-      } catch(IOException e) {
+      } catch(Exception e) {
         // Report a timeout if the httpGet request was aborted.  Otherwise rethrow exception.
         if (httpGet.isAborted()) {
           throw new IOException(String.format("Total Stellar REST request time to %s exceeded the configured timeout of %d ms.", httpGet.getURI().toString(), restConfig.getTimeout()));
diff --git a/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/RestFunctionsTest.java b/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/RestFunctionsTest.java
index ba80f02..4b912ef 100644
--- a/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/RestFunctionsTest.java
+++ b/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/RestFunctionsTest.java
@@ -23,10 +23,9 @@
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.http.client.CredentialsProvider;
-import org.apache.http.client.HttpClient;
 import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.protocol.HttpClientContext;
-import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.impl.client.BasicCredentialsProvider;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
@@ -66,7 +65,10 @@
 import static org.apache.metron.stellar.dsl.functions.RestConfig.TIMEOUT;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -552,15 +554,10 @@
    */
   @Test
   public void restGetShouldHandleIOException() throws IllegalArgumentException, IOException {
-    Map<String, Object> globalConfig = new HashMap<String, Object>() {{
-      put(STELLAR_REST_SETTINGS, new HashMap<String, Object>() {{
-        put(SOCKET_TIMEOUT, 1);
-      }});
-    }};
+    RestFunctions.RestGet restGet = spy(RestFunctions.RestGet.class);
+    doThrow(new IOException("io exception")).when(restGet).doGet(any(RestConfig.class), any(HttpGet.class), any(HttpClientContext.class));
 
-    context.addCapability(Context.Capabilities.GLOBAL_CONFIG, () -> globalConfig);
-
-    Object result = run(String.format("REST_GET('%s')", getUri), context);
+    Object result = restGet.apply(Collections.singletonList(getUri), context);
     Assert.assertNull(result);
   }