Added test cases for timeout + fixed nullpointer