diff --git a/lib/js/test/build.xml b/lib/js/test/build.xml
index c052e64..87fb231 100755
--- a/lib/js/test/build.xml
+++ b/lib/js/test/build.xml
@@ -119,7 +119,7 @@
     </exec>
   </target>
 
-  <target name="unittest" description="do unit tests with headless browser phantomjs" depends="phantomjs, jstest" if="phantomjs.present">
+  <target name="unittest" description="do unit tests with headless browser phantomjs" depends="init, phantomjs, jstest" if="phantomjs.present">
     <parallel>
       <exec executable="Xvfb" spawn="true" failonerror="false">
         <arg line=":99" />
diff --git a/lib/js/test/test.html b/lib/js/test/test.html
old mode 100644
new mode 100755
index 5039edb..9b225f0
--- a/lib/js/test/test.html
+++ b/lib/js/test/test.html
@@ -29,384 +29,12 @@
   <!-- jQuery -->
   <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.js" charset="utf-8"></script>
   
-  <!-- json2  -->
-  <script type="text/javascript" src="json2.js" charset="utf-8"></script>
-
   <!-- QUnit Test framework-->
   <script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js" charset="utf-8"></script>
   <link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" />
-
-  <script type="text/javascript" charset="utf-8">
-  //<![CDATA[
-  $(document).ready(function(){
-    var transport = new Thrift.Transport("/service");
-    var protocol  = new Thrift.Protocol(transport);
-    var client    = new ThriftTest.ThriftTestClient(protocol);
-
-    // all Languages in UTF-8
-    var stringTest = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, ‪Norsk (nynorsk)‬, ‪Norsk (bokmål)‬, Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
-
-
-    module("Base Types");
-
-    test("Void", function() {
-      equals(client.testVoid(), undefined);
-    });
-    test("String", function() {
-      equals(client.testString(stringTest), stringTest);
-
-      var specialCharacters = 'quote: \" backslash:' +
-            ' forwardslash-escaped: \/ ' +
-            ' backspace: \b formfeed: \f newline: \n return: \r tab: ' +
-            ' now-all-of-them-together: "\\\/\b\n\r\t' +
-            ' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><';
-      equals(client.testString(specialCharacters),specialCharacters);
-    });
-    test("Double", function() {
-      equals(client.testDouble(3.14), 3.14);
-    });
-    test("Byte", function() {
-      equals(client.testByte(0x01), 0x01);
-    });
-    test("I32", function() {
-      equals(client.testI32(Math.pow(2,30)), Math.pow(2,30));
-    });
-    test("I64", function() {
-      equals(client.testI64(Math.pow(2,60)), Math.pow(2,60));
-    });
-
-
-    module("Structured Types");
-
-    test("Struct", function() {
-      var structTestInput = new ThriftTest.Xtruct()
-      structTestInput.string_thing = 'worked'
-      structTestInput.byte_thing = 0x01
-      structTestInput.i32_thing = Math.pow(2,30)
-      structTestInput.i64_thing = Math.pow(2,60)
-
-      var structTestOutput = client.testStruct(structTestInput);
-
-      equals(structTestOutput.string_thing, structTestInput.string_thing);
-      equals(structTestOutput.byte_thing, structTestInput.byte_thing);
-      equals(structTestOutput.i32_thing, structTestInput.i32_thing);
-      equals(structTestOutput.i64_thing, structTestInput.i64_thing);
-      
-      equals(JSON.stringify(structTestOutput), JSON.stringify(structTestInput))
-    });
-    
-    test("Nest", function() {
-      var xtrTestInput = new ThriftTest.Xtruct()
-      xtrTestInput.string_thing = 'worked'
-      xtrTestInput.byte_thing = 0x01
-      xtrTestInput.i32_thing = Math.pow(2,30)
-      xtrTestInput.i64_thing = Math.pow(2,60)
-      
-      var nestTestInput = new ThriftTest.Xtruct2()
-      nestTestInput.byte_thing = 0x02
-      nestTestInput.struct_thing = xtrTestInput
-      nestTestInput.i32_thing = Math.pow(2,15)
-      
-      var nestTestOutput = client.testNest(nestTestInput);
-      
-      equals(nestTestOutput.byte_thing, nestTestInput.byte_thing);
-      equals(nestTestOutput.struct_thing.string_thing, nestTestInput.struct_thing.string_thing);
-      equals(nestTestOutput.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing);
-      equals(nestTestOutput.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing);
-      equals(nestTestOutput.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing);
-      equals(nestTestOutput.i32_thing, nestTestInput.i32_thing);
-      
-      equals(JSON.stringify(nestTestOutput), JSON.stringify(nestTestInput))
-    });
-
-    test("Map", function() {
-      var mapTestInput = {7:77, 8:88, 9:99};
-
-      var mapTestOutput = client.testMap(mapTestInput)
-
-      for (var key in mapTestOutput) {
-        equals(mapTestOutput[key], mapTestInput[key]);
-      }
-    });
-
-    test("StringMap", function() {
-      var mapTestInput = {
-        "a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",
-        "longValue":stringTest, stringTest:"long key"
-      };
-
-      var mapTestOutput = client.testStringMap(mapTestInput)
-
-      for (var key in mapTestOutput) {
-        equals(mapTestOutput[key], mapTestInput[key]);
-      }
-    });
-
-    test("Set", function() {
-      var setTestInput = new Array(1,2,3)
-      ok(client.testSet(setTestInput), setTestInput);
-    });
-    
-    test("List", function() {
-      var listTestInput = new Array(1,2,3)
-      ok(client.testList(listTestInput), listTestInput);
-    });
-    
-    test("Enum", function() {
-      equals(client.testEnum(ThriftTest.Numberz.ONE), ThriftTest.Numberz.ONE);
-    });
-    
-    test("TypeDef", function() {
-      equals(client.testTypedef(69), 69);
-    });
-
-    module("deeper!");
-    
-    test("MapMap", function() {
-      var mapMapTestExpectedResult = {
-        "4":{"1":1,"2":2,"3":3,"4":4},
-        "-4":{"-4":-4, "-3":-3, "-2":-2, "-1":-1}
-      };
-
-      var mapMapTestOutput = client.testMapMap(1);
-
-
-      for (var key in mapMapTestOutput) {
-        for (var key2 in mapMapTestOutput[key]) {
-          equals(mapMapTestOutput[key][key2], mapMapTestExpectedResult[key][key2]);
-        }
-      }
-      
-      equals(JSON.stringify(mapMapTestOutput), JSON.stringify(mapMapTestExpectedResult))
-    });
-
-
-    module("Exception");
-
-    test("Xception", function() {
-      expect(2);
-      try{
-        client.testException("Xception");
-      }catch(e){
-        equals(e.errorCode, 1001);
-        equals(e.message, "Xception");
-      }
-    });
-
-    test("no Exception", function() {
-      try{
-        client.testException("no Exception");
-      }catch(e){
-        ok(false);
-      }
-    });
-
-    test("unexpected Application Exception", function() {
-      expect(1);
-      try{
-        client.testException("ApplicationException");
-      } catch(e) {
-        ok(true); //@HACK: ignore faulty java server response for exceptions
-        //equals(e.message, "ApplicationException");
-      }
-    });
-
-
-    module("Insanity");
-
-    test("testInsanity", function() {
-      var insanity = {
-        "1":{
-          "3":{
-            "userMap":{ "8":8, "5":5 },
-            "xtructs":[{
-                "string_thing":"Goodbye4",
-                "byte_thing":4,
-                "i32_thing":4,
-                "i64_thing":4
-              },
-              {
-                "string_thing":"Hello2",
-                "byte_thing":2,
-                "i32_thing":2,
-                "i64_thing":2
-              }
-            ]
-          },
-          "2":{
-            "userMap":{ "8":8, "5":5 },
-            "xtructs":[{
-                "string_thing":"Goodbye4",
-                "byte_thing":4,
-                "i32_thing":4,
-                "i64_thing":4
-              },
-              {
-                "string_thing":"Hello2",
-                "byte_thing":2,
-                "i32_thing":2,
-                "i64_thing":2
-              }
-            ]
-          }
-        },
-        "2":{ "6":{ "userMap":null, "xtructs":null } }
-      };
-      var res = client.testInsanity("");
-      ok(res, JSON.stringify(res));
-      ok(insanity, JSON.stringify(insanity));
-      equals(JSON.stringify(res), JSON.stringify(insanity)) //TODO: read and compare maps recursively
-    });
-
-
-    //////////////////////////////////
-    //Run same tests asynchronously
-    jQuery.ajaxSetup({ timeout: 0 });
-    $(document).ajaxError( function() { QUnit.start(); } );
-
-    module("Async Manual");
-
-    test("testI32", function() {
-      expect( 2 );
-      QUnit.stop();
-
-      var transport = new Thrift.Transport();
-      var protocol  = new Thrift.Protocol(transport);
-      var client    = new ThriftTest.ThriftTestClient(protocol);
-
-      var jqxhr = jQuery.ajax({
-        url: "/service",
-        data: client.send_testI32(Math.pow(-2,31)),
-        type: "POST",
-        cache: false,
-        dataType: "text",
-        success: function(res){
-          transport.setRecvBuffer( res );
-          equals(client.recv_testI32(), Math.pow(-2,31));
-        },
-        error: function() { ok(false); },
-        complete: function() {
-          ok(true);
-          QUnit.start();
-        }
-      });
-    });
-
-
-    test("testI64", function() {
-      expect( 2 );
-      QUnit.stop();
-
-      var transport = new Thrift.Transport();
-      var protocol  = new Thrift.Protocol(transport);
-      var client    = new ThriftTest.ThriftTestClient(protocol);
-
-      jQuery.ajax({
-        url: "/service",
-        data: client.send_testI64(Math.pow(-2,61)),
-        type: "POST",
-        cache: false,
-        dataType: "text",
-        success: function(res){
-          transport.setRecvBuffer( res );
-          equals(client.recv_testI64(), Math.pow(-2,61));
-        },
-        error: function() { ok(false); },
-        complete: function() {
-          ok(true);
-          QUnit.start();
-        }
-      });
-    });
-
-
-
-    module("Async");
-
-    test("Double", function() {
-      expect( 1 );
-
-      QUnit.stop();
-      client.testDouble(3.14159265, function(result) {
-        equals(result, 3.14159265);
-        QUnit.start();
-      });
-    });
-
-    test("Byte", function() {
-      expect( 1 );
-
-      QUnit.stop();
-      client.testByte(0x01, function(result) {
-        equals(result, 0x01);
-        QUnit.start();
-      });
-    });
-
-    test("I32", function() {
-      expect( 3 );
-
-      QUnit.stop();
-      client.testI32(Math.pow(2,30), function(result) {
-        equals(result, Math.pow(2,30));
-        QUnit.start();
-      });
-
-      QUnit.stop();
-      var jqxhr = client.testI32(Math.pow(-2,31), function(result) {
-        equals(result, Math.pow(-2,31));
-      });
-
-      jqxhr.success(function(result) {
-        equals(result, Math.pow(-2,31));
-        QUnit.start();
-      });
-    });
-
-    test("I64", function() {
-      expect( 4 );
-
-      QUnit.stop();
-      client.testI64(Math.pow(2,60), function(result) {
-        equals(result, Math.pow(2,60));
-        QUnit.start();
-      });
-
-      QUnit.stop();
-      client.testI64(Math.pow(-2,61), function(result) {
-        equals(result, Math.pow(-2,61));
-      })
-      .error( function(e) {  ok(false); } )
-      .success(function(result) {
-        equals(result, Math.pow(-2,61));
-      })
-      .complete(function() {
-        ok(true);
-        QUnit.start();
-      });
-    });
-
-    test("Xception", function() {
-      expect( 2 );
-
-      QUnit.stop();
-
-      var dfd = client.testException("Xception", function(result) {
-        ok(false);
-        QUnit.start();
-      })
-      .error(function(e){
-        equals(e.errorCode, 1001);
-        equals(e.message, "Xception");
-        QUnit.start();
-      });
-    });
-
-
-  });
-  //]]>
-  </script>
-
+  
+  <!-- the Test Suite-->
+  <script type="text/javascript" src="test.js" charset="utf-8"></script>
 </head>
 <body>
   <h1 id="qunit-header">Thrift Javascript Bindings: Unit Test (<a href="https://svn.apache.org/repos/asf/thrift/trunk/test/ThriftTest.thrift">ThriftTest.thrift</a>)</h1>
diff --git a/lib/js/test/test.js b/lib/js/test/test.js
new file mode 100755
index 0000000..e24cb92
--- /dev/null
+++ b/lib/js/test/test.js
@@ -0,0 +1,386 @@
+﻿/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+ 
+/*
+ * JavaScript test suite
+ */
+
+var transport = new Thrift.Transport("/service");
+var protocol  = new Thrift.Protocol(transport);
+var client    = new ThriftTest.ThriftTestClient(protocol);
+
+// all Languages in UTF-8
+var stringTest = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, ‪Norsk (nynorsk)‬, ‪Norsk (bokmål)‬, Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
+
+
+module("Base Types");
+
+  test("Void", function() {
+    equals(client.testVoid(), undefined);
+  });
+  test("String", function() {
+    equals(client.testString(stringTest), stringTest);
+
+    var specialCharacters = 'quote: \" backslash:' +
+          ' forwardslash-escaped: \/ ' +
+          ' backspace: \b formfeed: \f newline: \n return: \r tab: ' +
+          ' now-all-of-them-together: "\\\/\b\n\r\t' +
+          ' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><';
+    equals(client.testString(specialCharacters),specialCharacters);
+  });
+  test("Double", function() {
+    equals(client.testDouble(3.14), 3.14);
+  });
+  test("Byte", function() {
+    equals(client.testByte(0x01), 0x01);
+  });
+  test("I32", function() {
+    equals(client.testI32(Math.pow(2,30)), Math.pow(2,30));
+  });
+  test("I64", function() {
+    equals(client.testI64(Math.pow(2,60)), Math.pow(2,60));
+  });
+
+
+module("Structured Types");
+
+  test("Struct", function() {
+    var structTestInput = new ThriftTest.Xtruct()
+    structTestInput.string_thing = 'worked'
+    structTestInput.byte_thing = 0x01
+    structTestInput.i32_thing = Math.pow(2,30)
+    structTestInput.i64_thing = Math.pow(2,60)
+
+    var structTestOutput = client.testStruct(structTestInput);
+
+    equals(structTestOutput.string_thing, structTestInput.string_thing);
+    equals(structTestOutput.byte_thing, structTestInput.byte_thing);
+    equals(structTestOutput.i32_thing, structTestInput.i32_thing);
+    equals(structTestOutput.i64_thing, structTestInput.i64_thing);
+    
+    equals(JSON.stringify(structTestOutput), JSON.stringify(structTestInput))
+  });
+
+  test("Nest", function() {
+    var xtrTestInput = new ThriftTest.Xtruct()
+    xtrTestInput.string_thing = 'worked'
+    xtrTestInput.byte_thing = 0x01
+    xtrTestInput.i32_thing = Math.pow(2,30)
+    xtrTestInput.i64_thing = Math.pow(2,60)
+    
+    var nestTestInput = new ThriftTest.Xtruct2()
+    nestTestInput.byte_thing = 0x02
+    nestTestInput.struct_thing = xtrTestInput
+    nestTestInput.i32_thing = Math.pow(2,15)
+    
+    var nestTestOutput = client.testNest(nestTestInput);
+    
+    equals(nestTestOutput.byte_thing, nestTestInput.byte_thing);
+    equals(nestTestOutput.struct_thing.string_thing, nestTestInput.struct_thing.string_thing);
+    equals(nestTestOutput.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing);
+    equals(nestTestOutput.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing);
+    equals(nestTestOutput.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing);
+    equals(nestTestOutput.i32_thing, nestTestInput.i32_thing);
+    
+    equals(JSON.stringify(nestTestOutput), JSON.stringify(nestTestInput))
+  });
+
+  test("Map", function() {
+    var mapTestInput = {7:77, 8:88, 9:99};
+
+    var mapTestOutput = client.testMap(mapTestInput)
+
+    for (var key in mapTestOutput) {
+      equals(mapTestOutput[key], mapTestInput[key]);
+    }
+  });
+
+  test("StringMap", function() {
+    var mapTestInput = {
+      "a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",
+      "longValue":stringTest, stringTest:"long key"
+    };
+
+    var mapTestOutput = client.testStringMap(mapTestInput)
+
+    for (var key in mapTestOutput) {
+      equals(mapTestOutput[key], mapTestInput[key]);
+    }
+  });
+
+  test("Set", function() {
+    var setTestInput = new Array(1,2,3)
+    ok(client.testSet(setTestInput), setTestInput);
+  });
+
+  test("List", function() {
+    var listTestInput = new Array(1,2,3)
+    ok(client.testList(listTestInput), listTestInput);
+  });
+
+  test("Enum", function() {
+    equals(client.testEnum(ThriftTest.Numberz.ONE), ThriftTest.Numberz.ONE);
+  });
+
+  test("TypeDef", function() {
+    equals(client.testTypedef(69), 69);
+  });
+
+
+module("deeper!");
+
+  test("MapMap", function() {
+    var mapMapTestExpectedResult = {
+      "4":{"1":1,"2":2,"3":3,"4":4},
+      "-4":{"-4":-4, "-3":-3, "-2":-2, "-1":-1}
+    };
+
+    var mapMapTestOutput = client.testMapMap(1);
+
+
+    for (var key in mapMapTestOutput) {
+      for (var key2 in mapMapTestOutput[key]) {
+        equals(mapMapTestOutput[key][key2], mapMapTestExpectedResult[key][key2]);
+      }
+    }
+    
+    equals(JSON.stringify(mapMapTestOutput), JSON.stringify(mapMapTestExpectedResult))
+  });
+
+
+module("Exception");
+
+  test("Xception", function() {
+    expect(2);
+    try{
+      client.testException("Xception");
+    }catch(e){
+      equals(e.errorCode, 1001);
+      equals(e.message, "Xception");
+    }
+  });
+
+  test("no Exception", function() {
+    try{
+      client.testException("no Exception");
+    }catch(e){
+      ok(false);
+    }
+  });
+
+  test("unexpected Application Exception", function() {
+    expect(1);
+    try{
+      client.testException("ApplicationException");
+    } catch(e) {
+      ok(true); //@HACK: ignore faulty java server response for exceptions
+      //equals(e.message, "ApplicationException");
+    }
+  });
+
+
+module("Insanity");
+
+  test("testInsanity", function() {
+    var insanity = {
+      "1":{
+        "3":{
+          "userMap":{ "8":8, "5":5 },
+          "xtructs":[{
+              "string_thing":"Goodbye4",
+              "byte_thing":4,
+              "i32_thing":4,
+              "i64_thing":4
+            },
+            {
+              "string_thing":"Hello2",
+              "byte_thing":2,
+              "i32_thing":2,
+              "i64_thing":2
+            }
+          ]
+        },
+        "2":{
+          "userMap":{ "8":8, "5":5 },
+          "xtructs":[{
+              "string_thing":"Goodbye4",
+              "byte_thing":4,
+              "i32_thing":4,
+              "i64_thing":4
+            },
+            {
+              "string_thing":"Hello2",
+              "byte_thing":2,
+              "i32_thing":2,
+              "i64_thing":2
+            }
+          ]
+        }
+      },
+      "2":{ "6":{ "userMap":null, "xtructs":null } }
+    };
+    var res = client.testInsanity("");
+    ok(res, JSON.stringify(res));
+    ok(insanity, JSON.stringify(insanity));
+    equals(JSON.stringify(res), JSON.stringify(insanity)) //TODO: read and compare maps recursively
+  });
+
+
+//////////////////////////////////
+//Run same tests asynchronously
+jQuery.ajaxSetup({ timeout: 0 });
+$(document).ajaxError( function() { QUnit.start(); } );
+
+module("Async Manual");
+
+  test("testI32", function() {
+    expect( 2 );
+    QUnit.stop();
+
+    var transport = new Thrift.Transport();
+    var protocol  = new Thrift.Protocol(transport);
+    var client    = new ThriftTest.ThriftTestClient(protocol);
+
+    var jqxhr = jQuery.ajax({
+      url: "/service",
+      data: client.send_testI32(Math.pow(-2,31)),
+      type: "POST",
+      cache: false,
+      dataType: "text",
+      success: function(res){
+        transport.setRecvBuffer( res );
+        equals(client.recv_testI32(), Math.pow(-2,31));
+      },
+      error: function() { ok(false); },
+      complete: function() {
+        ok(true);
+        QUnit.start();
+      }
+    });
+  });
+
+
+  test("testI64", function() {
+    expect( 2 );
+    QUnit.stop();
+
+    var transport = new Thrift.Transport();
+    var protocol  = new Thrift.Protocol(transport);
+    var client    = new ThriftTest.ThriftTestClient(protocol);
+
+    jQuery.ajax({
+      url: "/service",
+      data: client.send_testI64(Math.pow(-2,61)),
+      type: "POST",
+      cache: false,
+      dataType: "text",
+      success: function(res){
+        transport.setRecvBuffer( res );
+        equals(client.recv_testI64(), Math.pow(-2,61));
+      },
+      error: function() { ok(false); },
+      complete: function() {
+        ok(true);
+        QUnit.start();
+      }
+    });
+  });
+
+
+module("Async");
+
+  test("Double", function() {
+    expect( 1 );
+
+    QUnit.stop();
+    client.testDouble(3.14159265, function(result) {
+      equals(result, 3.14159265);
+      QUnit.start();
+    });
+  });
+
+  test("Byte", function() {
+    expect( 1 );
+
+    QUnit.stop();
+    client.testByte(0x01, function(result) {
+      equals(result, 0x01);
+      QUnit.start();
+    });
+  });
+
+  test("I32", function() {
+    expect( 3 );
+
+    QUnit.stop();
+    client.testI32(Math.pow(2,30), function(result) {
+      equals(result, Math.pow(2,30));
+      QUnit.start();
+    });
+
+    QUnit.stop();
+    var jqxhr = client.testI32(Math.pow(-2,31), function(result) {
+      equals(result, Math.pow(-2,31));
+    });
+
+    jqxhr.success(function(result) {
+      equals(result, Math.pow(-2,31));
+      QUnit.start();
+    });
+  });
+
+  test("I64", function() {
+    expect( 4 );
+
+    QUnit.stop();
+    client.testI64(Math.pow(2,60), function(result) {
+      equals(result, Math.pow(2,60));
+      QUnit.start();
+    });
+
+    QUnit.stop();
+    client.testI64(Math.pow(-2,61), function(result) {
+      equals(result, Math.pow(-2,61));
+    })
+    .error( function(e) {  ok(false); } )
+    .success(function(result) {
+      equals(result, Math.pow(-2,61));
+    })
+    .complete(function() {
+      ok(true);
+      QUnit.start();
+    });
+  });
+
+  test("Xception", function() {
+    expect( 2 );
+
+    QUnit.stop();
+
+    var dfd = client.testException("Xception", function(result) {
+      ok(false);
+      QUnit.start();
+    })
+    .error(function(e){
+      equals(e.errorCode, 1001);
+      equals(e.message, "Xception");
+      QUnit.start();
+    });
+  });
