/// <exception cref="System.Exception"></exception>
 internal ServerMessageDispatcherImpl(ObjectServerImpl server, ClientTransactionHandle
                                      transactionHandle, ISocket4 socket4, int threadID, bool loggedIn, object mainLock
                                      )
 {
     _mainLock          = mainLock;
     _transactionHandle = transactionHandle;
     _loggedin          = loggedIn;
     _server            = server;
     _threadID          = threadID;
     _socket            = new Socket4Adapter(socket4);
     _socket.SetSoTimeout(((Config4Impl)server.Configure()).TimeoutServerSocket());
 }
		/// <exception cref="System.Exception"></exception>
		internal ServerMessageDispatcherImpl(ObjectServerImpl server, ClientTransactionHandle
			 transactionHandle, ISocket4 socket4, int threadID, bool loggedIn, object mainLock
			)
		{
			_mainLock = mainLock;
			_transactionHandle = transactionHandle;
			_loggedin = loggedIn;
			_server = server;
			_threadID = threadID;
			_socket = new Socket4Adapter(socket4);
			_socket.SetSoTimeout(((Config4Impl)server.Configure()).TimeoutServerSocket());
		}
		public virtual void TestHandles()
		{
			IConfiguration config = Db4oFactory.NewConfiguration();
			config.Storage = new MemoryStorage();
			LocalObjectContainer db = (LocalObjectContainer)Db4oFactory.OpenFile(config, ClientTransactionTestUtil
				.MainfileName);
			ClientTransactionPool pool = new ClientTransactionPool(db);
			try
			{
				ClientTransactionHandle handleA = new ClientTransactionHandle(pool);
				Assert.AreEqual(db, handleA.Transaction().Container());
				ClientTransactionHandle handleB = new ClientTransactionHandle(pool);
				Assert.AreNotEqual(handleA.Transaction(), handleB.Transaction());
				Assert.AreEqual(db, handleB.Transaction().Container());
				Assert.AreEqual(2, pool.OpenTransactionCount());
				Assert.AreEqual(1, pool.OpenFileCount());
				handleA.AcquireTransactionForFile(ClientTransactionTestUtil.FilenameA);
				Assert.AreEqual(3, pool.OpenTransactionCount());
				Assert.AreEqual(2, pool.OpenFileCount());
				Assert.AreNotEqual(db, handleA.Transaction().Container());
				handleB.AcquireTransactionForFile(ClientTransactionTestUtil.FilenameA);
				Assert.AreEqual(4, pool.OpenTransactionCount());
				Assert.AreEqual(2, pool.OpenFileCount());
				Assert.AreNotEqual(handleA.Transaction(), handleB.Transaction());
				Assert.AreEqual(handleA.Transaction().Container(), handleB.Transaction().Container
					());
				handleA.ReleaseTransaction(ShutdownMode.Normal);
				Assert.AreEqual(db, handleA.Transaction().Container());
				Assert.AreNotEqual(db, handleB.Transaction().Container());
				Assert.AreEqual(3, pool.OpenTransactionCount());
				Assert.AreEqual(2, pool.OpenFileCount());
				handleB.ReleaseTransaction(ShutdownMode.Normal);
				Assert.AreEqual(db, handleB.Transaction().Container());
				Assert.AreEqual(2, pool.OpenTransactionCount());
				Assert.AreEqual(1, pool.OpenFileCount());
				handleB.Close(ShutdownMode.Normal);
				Assert.AreEqual(1, pool.OpenTransactionCount());
				handleA.Close(ShutdownMode.Normal);
				Assert.AreEqual(0, pool.OpenTransactionCount());
			}
			finally
			{
				pool.Close();
			}
		}