private void waitForResponseAsync(StubConnection conn) {
        boolean wasEmpty = awaitingResponse.isEmpty();
        awaitingResponse.add(conn);

        // If this isn't the first item being added, the thread is already running.
        if(!wasEmpty)
            return;
        
        if(responseThread != null) {
            try {
                responseThread.join();
            } catch(InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
            
        responseThread = new ResponseThread();
        responseThread.setName("Response thread");
        responseThread.start();
    }