Added helper method ReceiveMessage with timeout.