diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index afa7f707f17e656a0190ac0e5923105b841931a9..71878d02db069aef9b6c1b5ff15e84fa5568b81b 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -5123,6 +5123,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>QAModeEventHostPort</key>
+    <map>
+      <key>Comment</key>
+      <string>Enable Testing Features.</string>
+      <key>Persist</key>
+      <integer>0</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
     <key>QuietSnapshotsToDisk</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index f9e6db52c33fef1e4306a656c4028ecc3b9edce6..b61e75f60dea040a503e6391cd395938b7d34269 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -93,6 +93,10 @@
 #   include <sys/file.h> // For initMarkerFile support
 #endif
 
+#include "llapr.h"
+#include "apr_dso.h"
+#include <boost/lexical_cast.hpp>
+
 #include "llnotify.h"
 #include "llviewerkeyboard.h"
 #include "lllfsthread.h"
@@ -860,6 +864,11 @@ bool LLAppViewer::init()
 
 	LLViewerJoystick::getInstance()->init(false);
 
+	if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getS32("QAModeEventHostPort") > 0)
+	{
+		loadEventHostModule(gSavedSettings.getS32("QAModeEventHostPort"));
+	}
+	
 	return true;
 }
 
@@ -4085,3 +4094,45 @@ void LLAppViewer::handleLoginComplete()
 	}
 	writeDebugInfo();
 }
+
+// *TODO - generalize this and move DSO wrangling to a helper class -brad
+void LLAppViewer::loadEventHostModule(S32 listen_port) const
+{
+	std::string dso_name("liblleventhost");
+
+#if LL_WINDOWS
+	dso_name += ".dll";
+#elif LL_DARWIN
+	dso_name += ".dylib";
+#else
+	dso_name += ".so";
+#endif
+
+	std::string dso_path = gDirUtilp->findFile(dso_name,
+		gDirUtilp->getAppRODataDir(),
+		gDirUtilp->getExecutableDir());
+
+	apr_dso_handle_t * eventhost_dso_handle = NULL;
+	apr_pool_t * eventhost_dso_memory_pool = NULL;
+
+	//attempt to load the shared library
+	apr_pool_create(&eventhost_dso_memory_pool, NULL);
+	apr_status_t rv = apr_dso_load(&eventhost_dso_handle,
+		dso_path.c_str(),
+		eventhost_dso_memory_pool);
+	ll_apr_assert_status(rv);
+	llassert_always(eventhost_dso_handle != NULL);
+
+	int (*ll_plugin_start_func)(char const * const *, char const * const *) = NULL;
+	rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll_plugin_start_func, eventhost_dso_handle, "ll_plugin_start");
+
+	ll_apr_assert_status(rv);
+	llassert_always(ll_plugin_start_func != NULL);
+
+	std::string port_text = boost::lexical_cast<std::string>(listen_port);
+	std::vector<char const *> args;
+	args.push_back("-L");
+	args.push_back(port_text.c_str());
+
+	ll_plugin_start_func(&args[0], &args[0] + args.size());
+}
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 540c8785431ed074a4ffc667b4c34f113539fa27..1227ab470f06968a27beca39a9c67048951b2811 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -204,6 +204,8 @@ class LLAppViewer : public LLApp
     void sendLogoutRequest();
     void disconnectViewer();
 
+	void loadEventHostModule(S32 listen_port) const;
+	
 	// *FIX: the app viewer class should be some sort of singleton, no?
 	// Perhaps its child class is the singleton and this should be an abstract base.
 	static LLAppViewer* sInstance;