Class OxnspiInterop exposes the methods of the unmanaged library by importing the DLL RPC_RuntimeDllName.
        /// <summary>
        /// Initialize the client and server and build the transport tunnel between client and server.
        /// </summary>
        private void InitializeRPC()
        {
            string serverName = Common.GetConfigurationPropertyValue("SutComputerName", this.Site);
            string userName   = Common.GetConfigurationPropertyValue("User1Name", this.Site);
            string domainName = Common.GetConfigurationPropertyValue("Domain", this.Site);
            string password   = Common.GetConfigurationPropertyValue("User1Password", this.Site);

            // Create identity for the user to connect to the server.
            OxnspiInterop.CreateIdentity(
                domainName,
                userName,
                password);
            MapiContext rpcContext = MapiContext.GetDefaultRpcContext(this.Site);

            // Create Service Principal Name (SPN) string for the user to connect to the server.
            string userSpn = string.Empty;

            userSpn = Regex.Replace(rpcContext.SpnFormat, @"\[ServerName\]", serverName, RegexOptions.IgnoreCase);

            // Bind the client to RPC server.
            uint status = OxnspiInterop.BindToServer(serverName, rpcContext.AuthenLevel, rpcContext.AuthenService, rpcContext.TransportSequence, rpcContext.RpchUseSsl, rpcContext.RpchAuthScheme, userSpn, null, rpcContext.SetUuid);

            this.Site.Assert.AreEqual <uint>(0, status, "Create binding handle with server {0} should success!", serverName);
            this.rpcBinding = OxnspiInterop.GetBindHandle();
            this.Site.Assert.AreNotEqual <IntPtr>(IntPtr.Zero, this.rpcBinding, "A valid RPC Binding handle is needed!");
        }
 /// <summary>
 /// This method is used to implement clean-up codes.
 /// </summary>
 /// <param name="disposing">Set TRUE to dispose resource otherwise set FALSE.</param>
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     OxnspiInterop.RpcBindingFree(ref this.rpcBinding);
 }