title: Running AsyncHttpClient with JUNIT Tests
body: <p>I've got the following JUnit test I've been trying to run. When I try to print out the userHash string, I get that the string is null. This suggests that the httpclient isn't running at all. I've been following this post...</p>
  
  <p><a href="https://github.com/loopj/android-async-http/issues/173" rel="nofollow">https://github.com/loopj/android-async-http/issues/173</a></p>
  
  <p>Here is my class.</p>
  
  <pre><code>public class ECApiManagerTests {
      InstrumentationTestCase runnerHelper = new InstrumentationTestCase();
      private final String userEmail = "removed";
      private final String passWord = "removed";
      String userHash;
  
  
      @Test
      public void testPOST()throws Throwable{
          final AsyncHttpClient httpClient = new AsyncHttpClient();
  
  
          runnerHelper.runTestOnUiThread(new Runnable() {
              @Override
              public void run() {
                  RequestParams params = new RequestParams();
                  params.put("email", userEmail);
                  params.put("password", passWord);
                  httpClient.post("https://edu.chat/api/login/", params, new AsyncHttpResponseHandler() {
                      @Override
                      public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
                          //called when response code 200
                          userHash = new String(responseBody);
                      }
                      @Override
                      public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
  
                      }
                  });
  
  
              }
          });
  
          try {
              System.out.println(userHash);
              JSONObject obj = new JSONObject(userHash);
              Assert.assertEquals("true", obj.getString("success"));
  
          } catch (JSONException e) {
              e.printStackTrace();
          }
  
  
  
  
  
      }
  </code></pre>