Added ability to set timeout, made the server respose's body public to caller.
fixed null-pointer exception
fixed an index out of bounds error.