From one point of view, first case (fixing in Agent) is better as it allows to fix this problem for any implementation of Connection interface.
But from another side, we can think about this bug as problem in SocketConnection(as it doesn't throws InterruptedException when should).

May be, third proposed by Volker Simonis variant is the best?

It is about to insert following code in SocketConnection.waitUntilClosed() method:

Maybe it is best to do both fixes then. Correct exception is thrown, will actually be caught in Agent by that catch block. But the Agent code will also check to clear the interrupted flag before starting the next test, which hopefully ensure that it stays fixed with other connection classes.