HttpGet httpget = new HttpGet("http://localhost:10.0.2.2:8009/BookService/rest/bookresource/hello");
the host of your URL is http://localhost:10.0.2.2:8009/
and is therefore invalid .. change it to either http://localhost:8009/
, or http://10.0.2.2:8009/
and that should fix it. The bad URL is likely causing an Exception in the HttpGet where it processes the URL is returning a null to the rest of the code