You know, that's really a tough question to answer and there are so many issues to consider when answering it.
Here's the hard part: Animal testing can bring great benefits to society when it's done for things like cancer research, etc. But it is also immoral in my opinion, to test on animals to see if the latest chemical weapon will be effective or for food additives, makeup, etc. That is to say, things that are superficial and truly useless to society or aimed at personal vanity.
My yellow labrador retriever, Triever, is currently dying from cancer. The drugs we're using are to help make his last few days as comfortable as possible. I have no doubt, that the drugs have been tested on animals. He's getting benefits from that testing and it's helping to make the quality of life (and that's a key factor; the quality of life) better for his remaining days. If those drugs hadn't been tested, we wouldn't know that they would work. That same drug is used for humans too. Other than the odd bout here and there with internal bleeding, I don't even think he's aware he is as ill as he is, nor do I think he's currently experiencing any pain. He still wants to play with his tug toy and go outside an chew on a big stick.
So to answer your question, I'd actually have to ask the same question you asked. IS it ethical to conduct research on animals when it causes immense pain and discomfort?
The only one who can answer that question for the both of us isn't saying much, but I'd bet a lot of it depends on the intent of the research.
It's not much to go on, I know. But to be truthful, I really don't think anyone with morals, a conscience and a belief in a supreme diety can give you a definitive answer.