TurnPort should retry allocation with a new address on error STUN_ERROR_ALLOCATION_MISMATCH.

BUG=3570
R=juberti@webrtc.org, mallinath@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/20999004

git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@7070 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/base/virtualsocketserver.cc b/base/virtualsocketserver.cc
index f8e8dde..90d19e4 100644
--- a/base/virtualsocketserver.cc
+++ b/base/virtualsocketserver.cc
@@ -639,6 +639,10 @@
   return !msg_queue_->IsQuitting();
 }
 
+void VirtualSocketServer::SetNextPortForTesting(uint16 port) {
+  next_port_ = port;
+}
+
 int VirtualSocketServer::Bind(VirtualSocket* socket,
                               const SocketAddress& addr) {
   ASSERT(NULL != socket);
diff --git a/base/virtualsocketserver.h b/base/virtualsocketserver.h
index 87e3536..0ea51ab 100644
--- a/base/virtualsocketserver.h
+++ b/base/virtualsocketserver.h
@@ -110,6 +110,9 @@
   // if Thread::Stop() was called.
   bool ProcessMessagesUntilIdle();
 
+  // Sets the next port number to use for testing.
+  void SetNextPortForTesting(uint16 port);
+
  protected:
   // Returns a new IP not used before in this network.
   IPAddress GetNextIP(int family);