Index: /branches/proxy/src/lib/network/message_manager.cc
===================================================================
--- /branches/proxy/src/lib/network/message_manager.cc	(revision 9652)
+++ /branches/proxy/src/lib/network/message_manager.cc	(revision 9653)
@@ -239,7 +239,8 @@
       outgoingMessageQueue[userId].toAck.push_back( number );
 
+//     PRINTF(0)("got message with type: %i\n", messageType);
     assert( i + messageLength <= length );
     // make sure there is a message handler for this message type
-    assert( messageHandlerMap.find( (MessageType)messageType ) == messageHandlerMap.end());
+    assert( messageHandlerMap.find( (MessageType)messageType ) != messageHandlerMap.end());
 
 
@@ -453,9 +454,9 @@
          recieverType == RT_ALL_BUT_ME  ||
          recieverType == RT_USER        && it->first == reciever ||
-        recieverType == RT_USER        && reciever == NET_ID_MASTER_SERVER && !getNetworkStream()->isUserMasterServer( it->first ) ||  // special case: forward
+         recieverType == RT_USER        && reciever == NET_ID_MASTER_SERVER && !getNetworkStream()->isUserMasterServer( it->first ) ||  //(*)
          recieverType == RT_NOT_USER    && it->first != reciever ||
          recieverType == RT_SERVER      && getNetworkStream()->isUserMasterServer( it->first ) ||
          recieverType == RT_SERVER      && getNetworkStream()->isUserProxyServerActive( it->first )
-       )
+       )// (*) special case: forward
     {
       NetworkMessage msg;
Index: /branches/proxy/src/lib/network/network_manager.cc
===================================================================
--- /branches/proxy/src/lib/network/network_manager.cc	(revision 9652)
+++ /branches/proxy/src/lib/network/network_manager.cc	(revision 9653)
@@ -38,4 +38,6 @@
 
 SHELL_COMMAND(debug, NetworkManager, debug);
+SHELL_COMMAND(redirTest, NetworkManager, setRedirectionTest);
+
 
 
@@ -142,5 +144,5 @@
 
   // then start the server
-//   this->networkStream->createServer( port, port + 1, port + 2);
+  this->networkStream->createServer( port, port + 1, port + 2);
 
   // and to the other proxy servers also, this would be very nice if its works
@@ -232,2 +234,8 @@
   PRINT(0)("===========================================\n");
 }
+
+
+void NetworkManager::setRedirectionTest()
+{
+  this->networkStream->setRedirectionTest();
+}
Index: /branches/proxy/src/lib/network/network_manager.h
===================================================================
--- /branches/proxy/src/lib/network/network_manager.h	(revision 9652)
+++ /branches/proxy/src/lib/network/network_manager.h	(revision 9653)
@@ -46,4 +46,7 @@
     void debug();
 
+    void setRedirectionTest();
+
+
 
   private:
Index: /branches/proxy/src/lib/network/network_stream.cc
===================================================================
--- /branches/proxy/src/lib/network/network_stream.cc	(revision 9652)
+++ /branches/proxy/src/lib/network/network_stream.cc	(revision 9653)
@@ -390,4 +390,7 @@
   this->handleDownstream( tick );
   this->handleUpstream( tick );
+
+  if( this->bSoftRedirect)
+    this->softReconnectToServer(0, IP("localhost", 10001));
 }
 
@@ -481,11 +484,13 @@
         userId = 1;
 
+        // find an empty slot within the range
         for( int i = 0; i < NET_ID_PROXY_MAX; i++)
         {
-          if( this->peers.find( i) != this->peers.end())
+          if( this->peers.find( i) == this->peers.end())
+          {
             userId = i;
-          break;
+            break;
+          }
         }
-        userId++;
 
 //         for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++ )
@@ -832,10 +837,41 @@
 /**
  * softly reconnecting to another server
+ * @param serverUserId the id of the client
  * @param address  of the new server
  */
-void NetworkStream::softReconnectToServer(IP address)
-{
-  this->networkMonitor->setForcedReconnection(address);
-  this->handleReconnect( NET_ID_MASTER_SERVER);
+void NetworkStream::softReconnectToServer(int serverUserId, IP address)
+{
+//   this->networkMonitor->setForcedReconnection(address);
+//   this->handleReconnect( NET_ID_MASTER_SERVER);
+
+  // create the new udp socket and open the connection to the soft connection port
+  NetworkSocket* newSocket = new UdpSocket(address.ipString(), 10001);
+
+  // delete the synchronization state of this client for all syncs
+  for ( SynchronizeableList::iterator it2 = synchronizeables.begin(); it2 != synchronizeables.end(); it2++ )  {
+    (*it2)->cleanUpUser( serverUserId );
+  }
+
+  // temp save the old socket
+  NetworkSocket* oldSocket = this->peers[serverUserId].socket;
+
+  // now integrate the new socket
+  this->peers[serverUserId].socket = newSocket;
+
+  return;
+
+  // now remove the old socket
+  oldSocket->disconnectServer();
+  delete oldSocket;
+
+  // replace the old connection monitor
+  if ( this->peers[serverUserId].connectionMonitor )
+    delete this->peers[serverUserId].connectionMonitor;
+  this->peers[serverUserId].connectionMonitor = new ConnectionMonitor(serverUserId);
+
+  // remove old node from the network monitor
+  this->networkMonitor->removeNode(&this->peers[serverUserId]);
+
+  this->bSoftRedirect = false;
 }
 
@@ -859,5 +895,5 @@
   this->peers[userId].connectionMonitor = NULL;
 
-
+  // delete the synchronization state of this client for all syncs
   for ( SynchronizeableList::iterator it2 = synchronizeables.begin(); it2 != synchronizeables.end(); it2++ )  {
     (*it2)->cleanUpUser( userId );
@@ -872,5 +908,4 @@
   this->peers.erase( userId);
 }
-
 
 
Index: /branches/proxy/src/lib/network/network_stream.h
===================================================================
--- /branches/proxy/src/lib/network/network_stream.h	(revision 9652)
+++ /branches/proxy/src/lib/network/network_stream.h	(revision 9653)
@@ -50,5 +50,5 @@
 
     void reconnectToServer(IP address);
-    void softReconnectToServer(IP address);
+    void softReconnectToServer(int serverUserId, IP address);
 
 
@@ -75,4 +75,6 @@
     inline PeerInfo* getPeerInfo() { return this->pInfo; }
     inline PeerList getPeerInfoList() { return this->peers; }
+
+    inline void setRedirectionTest() { this->bSoftRedirect = true; }
 
     /* data processing*/
@@ -104,4 +106,5 @@
     void handleReconnect( int userId );
     void handleDisconnect( int userId );
+    void handleSoftDisconnect( int userId);
 
     void writeToNewDict( byte * data, int length, bool upstream );
@@ -134,4 +137,5 @@
     bool                       bRedirect;                   //!< true if the master server sent a redirect command
     int                        redirectionUID;              //!< uid of the redir host
+    bool                       bSoftRedirect;               //!< tsting
 };
 #endif /* _NETWORK_STREAM */
Index: /branches/proxy/src/lib/network/synchronizeable.cc
===================================================================
--- /branches/proxy/src/lib/network/synchronizeable.cc	(revision 9652)
+++ /branches/proxy/src/lib/network/synchronizeable.cc	(revision 9653)
@@ -126,5 +126,5 @@
 int Synchronizeable::getStateDiff( int userId, byte* data, int maxLength, int stateId, int fromStateId, int priorityTH )
 {
-  //make sure this user has his history
+  // make sure this user has his history or resize for new clients
   if ( (int)sentStates.size() <= userId )
     sentStates.resize( userId+1 );
@@ -133,4 +133,5 @@
   int neededSize = 0;
 
+  // calculate the needed space for network packet by summing up
   for ( SyncVarList::iterator it = syncVarList.begin(); it != syncVarList.end(); it++ )
   {
Index: /branches/proxy/src/lib/network/udp_socket.h
===================================================================
--- /branches/proxy/src/lib/network/udp_socket.h	(revision 9652)
+++ /branches/proxy/src/lib/network/udp_socket.h	(revision 9653)
@@ -41,4 +41,13 @@
 
   private:
+    void init();
+
+    bool writeRawPacket( byte * data, int length );
+    bool checkUdpCmd( byte udpCmd );
+    bool checkRandomByte( byte rndByte );
+    byte generateNewRandomByte();
+
+
+  private:
     UdpServerSocket * serverSocket;   //!< will get packets here
     int               userId;         //!< user id used by serverSocket
@@ -47,12 +56,4 @@
 
     byte              randomByte;     //!< contains random bytes & 0xFC
-
-    bool writeRawPacket( byte * data, int length );
-    bool checkUdpCmd( byte udpCmd );
-    bool checkRandomByte( byte rndByte );
-    byte generateNewRandomByte();
-
-    void init();
-
 };
 
