diff --git a/advagg.module b/advagg.module
index 6a118f8..722bfb1 100644
--- a/advagg.module
+++ b/advagg.module
@@ -2847,6 +2847,17 @@ function advagg_async_connect_http_request($url, array $options = array()) {
     // Create a stream with context. Allows verification of a SSL certificate.
     $fp = @stream_socket_client($socket, $errno, $errstr, $options['timeout'], STREAM_CLIENT_ASYNC_CONNECT|STREAM_CLIENT_CONNECT, $options['context']);
   }
+  // Test to see if STREAM_CLIENT_ASYNC_CONNECT works.
+  $meta_data = @stream_get_meta_data($fp);
+  if (empty($meta_data['stream_type'])) {
+    if (empty($options['context'])) {
+      $fp = @stream_socket_client($socket, $errno, $errstr, $options['timeout'], STREAM_CLIENT_CONNECT);
+    }
+    else {
+      // Create a stream with context. Allows verification of a SSL certificate.
+      $fp = @stream_socket_client($socket, $errno, $errstr, $options['timeout'], STREAM_CLIENT_CONNECT, $options['context']);
+    }
+  }
 
   // Make sure the socket opened properly.
   if (!$fp) {
@@ -2925,7 +2936,7 @@ function advagg_async_connect_http_request($url, array $options = array()) {
  * @return bool
  *   TRUE if function worked as planed.
  */
-function advagg_async_send_http_request($fp = NULL, $request = '', $timeout = 1) {
+function advagg_async_send_http_request($fp = NULL, $request = '', $timeout = 30) {
   static $requests = array();
   static $registered = FALSE;
 
