当前位置: 首页>>代码示例>>C#>>正文


C# TransportType类代码示例

本文整理汇总了C#中TransportType的典型用法代码示例。如果您正苦于以下问题:C# TransportType类的具体用法?C# TransportType怎么用?C# TransportType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TransportType类属于命名空间,在下文中一共展示了TransportType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: KerberosFunctionalClient

        /// <summary>
        /// Construct a Kerberos test client for FAST
        /// </summary>
        /// <param name="domain">The realm part of the client's principal identifier.
        /// This argument cannot be null.</param>
        /// <param name="cName">The account to logon the remote machine. Either user account or computer account
        /// This argument cannot be null.</param>
        /// <param name="password">The password of the user. This argument cannot be null.</param>
        /// <param name="accountType">The type of the logon account. User or Computer</param>
        public KerberosFunctionalClient(string domain, string cName, string password, KerberosAccountType accountType, KerberosTicket armorTicket, EncryptionKey armorSessionKey, string kdcAddress, int kdcPort, TransportType transportType, KerberosConstValue.OidPkt omiPkt, ITestSite baseTestSite)
            : base(domain, cName, password, accountType, armorTicket, armorSessionKey, kdcAddress, kdcPort, transportType, omiPkt)
        {
            testSite = baseTestSite;
            if (accountType == KerberosAccountType.Device)
            {
                testSite.Log.Add(LogEntryKind.Debug, "Construct Kerberos client using computer account: {0}@{1}.",
                                    cName, domain);
            }
            else
            {
                testSite.Log.Add(LogEntryKind.Debug, "Construct Kerberos client using user account: {0}@{1}.",
                                    cName, domain);
            }
            EncryptionType[] encryptionTypes = new EncryptionType[]
            {
                EncryptionType.AES256_CTS_HMAC_SHA1_96,
                EncryptionType.AES128_CTS_HMAC_SHA1_96,
                EncryptionType.RC4_HMAC,
                EncryptionType.RC4_HMAC_EXP,
                EncryptionType.DES_CBC_CRC,
                EncryptionType.DES_CBC_MD5
            };

            KerbInt32[] etypes = new KerbInt32[encryptionTypes.Length];
            for (int i = 0; i < encryptionTypes.Length; i++)
            {
                etypes[i] = new KerbInt32((int)encryptionTypes[i]);
            }
            Asn1SequenceOf<KerbInt32> etype = new Asn1SequenceOf<KerbInt32>(etypes);

            Context.SupportedEType = etype;

            Context.Pvno = KerberosConstValue.KERBEROSV5;
        }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:44,代码来源:KerberosFunctionalClient.cs

示例2: ReconnectionSuccesfulTest

        public void ReconnectionSuccesfulTest(HostType hostType, TransportType transportType, MessageBusType messageBusType)
        {
            using (var host = CreateHost(hostType, transportType))
            {
                // Arrange
                var mre = new ManualResetEventSlim(false);
                host.Initialize(keepAlive: null, messageBusType: messageBusType);
                var connection = CreateConnection(host, "/my-reconnect");

                using (connection)
                {
                    ((Client.IConnection)connection).KeepAliveData = new KeepAliveData(TimeSpan.FromSeconds(2));

                    connection.Reconnected += () =>
                    {
                        mre.Set();
                    };

                    connection.Start(host.Transport).Wait();

                    // Assert
                    Assert.True(mre.Wait(TimeSpan.FromSeconds(10)));

                    // Clean-up
                    mre.Dispose();
                }
            }
        }
开发者ID:RyanChristensen,项目名称:SignalR,代码行数:28,代码来源:KeepAliveFacts.cs

示例3: SuccessiveTimeoutTest

        public void SuccessiveTimeoutTest(HostType hostType, TransportType transportType)
        {
            using (var host = CreateHost(hostType, transportType))
            {
                // Arrange
                var mre = new ManualResetEventSlim(false);
                host.Initialize(keepAlive: null);
                var connection = CreateConnection(host, "/my-reconnect");

                ((Client.IConnection)connection).KeepAliveData = new KeepAliveData(TimeSpan.FromSeconds(2));

                connection.Reconnected += () =>
                {
                    mre.Set();
                };

                connection.Start(host.Transport).Wait();

                // Assert that Reconnected is called
                Assert.True(mre.Wait(TimeSpan.FromSeconds(10)));

                // Assert that Reconnected is called again
                mre.Reset();
                Assert.True(mre.Wait(TimeSpan.FromSeconds(10)));

                // Clean-up
                mre.Dispose();
                connection.Stop();
            }
        }
开发者ID:hallco978,项目名称:SignalR,代码行数:30,代码来源:KeepAliveFacts.cs

示例4: TransportTimesOutIfNoInitMessage

        public async Task TransportTimesOutIfNoInitMessage(HostType hostType, TransportType transportType, MessageBusType messageBusType)
        {
            var mre = new AsyncManualResetEvent();

            using (var host = CreateHost(hostType, transportType))
            {
                host.Initialize(transportConnectTimeout: 1, messageBusType: messageBusType);

                HubConnection hubConnection = CreateHubConnection(host, "/no-init");

                IHubProxy proxy = hubConnection.CreateHubProxy("DelayedOnConnectedHub");

                using (hubConnection)
                {
                    try
                    {
                        await hubConnection.Start(host.Transport);
                    }
                    catch
                    {
                        mre.Set();
                    }

                    Assert.True(await mre.WaitAsync(TimeSpan.FromSeconds(10)));
                }
            }
        }
开发者ID:Choulla-Naresh8264,项目名称:SignalR,代码行数:27,代码来源:HubProxyFacts.cs

示例5: ImportTransportTypes

        public ActionResult ImportTransportTypes()
        {
            String[] transportTypes = new[]
            {
                "Автобусы",
                "Троллейбусы",
                "Маршрутные такси"
            };

            using (DataContext dataContext = new DataContext())
            {
                foreach (String typeName in transportTypes)
                {
                    TransportType type = new TransportType()
                    {
                        Name = typeName
                    };

                    dataContext.TransportTypes.Add(type);
                    dataContext.SaveChanges();
                }
            }

            return this.Content("Transport types imported");
        }
开发者ID:Andrion,项目名称:StationsPathProvider,代码行数:25,代码来源:ParserController.cs

示例6: CreateTransport

 public IVoIPTransport CreateTransport(TransportType transportType, TransportConfig config)
 {
     var tpt = CreateTransport(transportType);
     using (((Initializable)tpt).InitializationScope())
         if (config != null) tpt.SetConfig(config);
     return tpt;
 }
开发者ID:kumarkmmca,项目名称:pjsip4net,代码行数:7,代码来源:DefaultVoIPTransportFactory.cs

示例7: ReconnectRequestPathEndsInReconnect

        public void ReconnectRequestPathEndsInReconnect(HostType hostType, TransportType transportType)
        {
            using (var host = CreateHost(hostType, transportType))
            {
                // Arrange
                var tcs = new TaskCompletionSource<bool>();
                var receivedMessage = false;

                host.Initialize(keepAlive: null,
                                connectionTimeout: 2,
                                disconnectTimeout: 6);

                var connection = CreateConnection(host, "/examine-reconnect");

                connection.Received += (reconnectEndsPath) =>
                {
                    if (!receivedMessage)
                    {
                        tcs.TrySetResult(reconnectEndsPath == "True");
                        receivedMessage = true;
                    }
                };

                connection.Start(host.Transport).Wait();

                // Wait for reconnect
                Assert.True(tcs.Task.Wait(TimeSpan.FromSeconds(10)));
                Assert.True(tcs.Task.Result);

                // Clean-up
                connection.Stop();
            }
        }
开发者ID:hallco978,项目名称:SignalR,代码行数:33,代码来源:ConnectionFacts.cs

示例8: KpasswdClient

 /// <summary>
 /// Create a Kpassword client instance
 /// </summary>
 /// <param name="kdcAddress">The IP address of the KDC.</param>
 /// <param name="kdcPort">The port of the KDC.</param>
 /// <param name="transportType">Whether the transport is TCP or UDP transport.</param>
 public KpasswdClient(string kdcAddress, int kdcPort, TransportType transportType)
 {
     this.Context = new KerberosContext();
     this.kdcAddress = kdcAddress;
     this.kdcPort = kdcPort;
     this.transportType = transportType;
 }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:13,代码来源:KpasswdClient.cs

示例9: ThrownWebExceptionShouldBeUnwrapped

            public void ThrownWebExceptionShouldBeUnwrapped(HostType hostType, TransportType transportType)
            {
                using (var host = CreateHost(hostType, transportType))
                {
                    host.Initialize();

                    var connection = new Client.Connection(host.Url + "/ErrorsAreFun");

                    // Expecting 404
                    var aggEx = Assert.Throws<AggregateException>(() => connection.Start(host.Transport).Wait());

                    connection.Stop();

                    using (var ser = aggEx.GetError())
                    {
                        if (hostType == HostType.IISExpress)
                        {
                            Assert.Equal(System.Net.HttpStatusCode.InternalServerError, ser.StatusCode);
                        }
                        else
                        {
                            Assert.Equal(System.Net.HttpStatusCode.NotFound, ser.StatusCode);
                        }

                        Assert.NotNull(ser.ResponseBody);
                        Assert.NotNull(ser.Exception);
                    }
                }
            }
开发者ID:kppullin,项目名称:SignalR,代码行数:29,代码来源:ConnectionFacts.cs

示例10: CreateInputGateway

 /// <summary>
 /// Creates the input gateway.
 /// </summary>
 /// <param name="uri">The URI.</param>
 /// <param name="transportType">The supported transports.</param>
 /// <param name="numberOfParallelTasks">The number of parallel tasks.</param>
 /// <param name="maxReijections">The max reijections.</param>
 /// <returns></returns>
 public static RouterInputGateway CreateInputGateway(Uri uri, TransportType transportType, int numberOfParallelTasks, int maxReijections)
 {
     return new RouterInputGateway(EndPointFactory.CreateReceiverEndPoint(uri, transportType, numberOfParallelTasks), maxReijections)
     {
         Logger = LoggerManager.Instance
     };
 }
开发者ID:petxo,项目名称:HermEsb,代码行数:15,代码来源:RouterGatewayFactory.cs

示例11: TransportListener

        TransportListener(IPEndPoint endPoint)
        {
            if (TD.TcpTransportListenerListeningStartIsEnabled())
            {
                TD.TcpTransportListenerListeningStart(this.EventTraceActivity, GetRemoteEndpointAddressPort(endPoint));
            }

            transportType = TransportType.Tcp;
            SocketSettings socketSettings = new SocketSettings();
            IConnectionListener connectionListener = null;
            if (endPoint.Address.Equals(IPAddress.Broadcast))
            {
                if (Socket.OSSupportsIPv4)
                {
                    connectionListener = new SocketConnectionListener(new IPEndPoint(IPAddress.Any, endPoint.Port), socketSettings, true);
                    demuxer = Go(connectionListener);
                }

                if (Socket.OSSupportsIPv6)
                {
                    connectionListener = new SocketConnectionListener(new IPEndPoint(IPAddress.IPv6Any, endPoint.Port), socketSettings, true);
                    demuxerV6 = Go(connectionListener);
                }
            }
            else
            {
                connectionListener = new SocketConnectionListener(endPoint, socketSettings, true);
                demuxer = Go(connectionListener);
            }

            if (TD.TcpTransportListenerListeningStopIsEnabled())
            {
                TD.TcpTransportListenerListeningStop(this.EventTraceActivity);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:35,代码来源:TransportListener.cs

示例12: ClientStopsReconnectingAfterDisconnectTimeout

            public void ClientStopsReconnectingAfterDisconnectTimeout(HostType hostType, TransportType transportType)
            {
                using (var host = CreateHost(hostType, transportType))
                {
                    host.Initialize(keepAlive: 1, disconnectTimeout: 2);
                    var connection = new Client.Hubs.HubConnection(host.Url);
                    var reconnectWh = new ManualResetEventSlim();
                    var disconnectWh = new ManualResetEventSlim();

                    connection.Reconnecting += () =>
                    {
                        reconnectWh.Set();
                        Assert.Equal(ConnectionState.Reconnecting, connection.State);
                    };

                    connection.Closed += () =>
                    {
                        disconnectWh.Set();
                        Assert.Equal(ConnectionState.Disconnected, connection.State);
                    };

                    connection.Start(host.Transport).Wait();
                    host.Shutdown();

                    Assert.True(reconnectWh.Wait(TimeSpan.FromSeconds(5)));
                    Assert.True(disconnectWh.Wait(TimeSpan.FromSeconds(5)));
                }
            }
开发者ID:rustd,项目名称:SignalR,代码行数:28,代码来源:ConnectionFacts.cs

示例13: AddingToMultipleGroups

        public void AddingToMultipleGroups(HostType hostType, TransportType transportType)
        {
            using (var host = CreateHost(hostType, transportType))
            {
                host.Initialize();
                int max = 10;

                var countDown = new CountDownRange<int>(Enumerable.Range(0, max));
                var connection = new Client.Hubs.HubConnection(host.Url);
                var proxy = connection.CreateHubProxy("MultGroupHub");

                proxy.On<User>("onRoomJoin", user =>
                {
                    Assert.True(countDown.Mark(user.Index));
                });

                connection.Start(host.Transport).Wait();

                for (int i = 0; i < max; i++)
                {
                    var user = new User { Index = i, Name = "tester", Room = "test" + i };
                    proxy.InvokeWithTimeout("login", user);
                    proxy.InvokeWithTimeout("joinRoom", user);
                }

                Assert.True(countDown.Wait(TimeSpan.FromSeconds(30)), "Didn't receive " + max + " messages. Got " + (max - countDown.Count) + " missed " + String.Join(",", countDown.Left.Select(i => i.ToString())));

                connection.Stop();
            }
        }
开发者ID:rustd,项目名称:SignalR,代码行数:30,代码来源:HubFacts.cs

示例14: MarkActiveStopsConnectionIfCalledAfterExtendedPeriod

        public void MarkActiveStopsConnectionIfCalledAfterExtendedPeriod(HostType hostType, TransportType transportType, MessageBusType messageBusType)
        {
            using (var host = CreateHost(hostType, transportType))
            {
                host.Initialize(messageBusType: messageBusType);
                var connection = CreateHubConnection(host);

                using (connection)
                {
                    var disconnectWh = new ManualResetEventSlim();

                    connection.Closed += () =>
                    {
                        disconnectWh.Set();
                    };

                    connection.Start(host.Transport).Wait();

                    // The MarkActive interval should check the reconnect window. Since this is short it should force the connection to disconnect.
                    ((Client.IConnection)connection).ReconnectWindow = TimeSpan.FromSeconds(1);

                    Assert.True(disconnectWh.Wait(TimeSpan.FromSeconds(15)), "Closed never fired");
                }
            }
        }
开发者ID:kietnha,项目名称:SignalR,代码行数:25,代码来源:ConnectionFacts.cs

示例15: ReconnectExceedingReconnectWindowDisconnectsWithFastBeatInterval

        public void ReconnectExceedingReconnectWindowDisconnectsWithFastBeatInterval(HostType hostType, TransportType transportType, MessageBusType messageBusType)
        {
            // Test cannot be async because if we do host.ShutDown() after an await the connection stops.

            using (var host = CreateHost(hostType, transportType))
            {
                host.Initialize(keepAlive: 9, messageBusType: messageBusType);
                var connection = CreateHubConnection(host);

                using (connection)
                {
                    var disconnectWh = new ManualResetEventSlim();

                    connection.Closed += () =>
                    {
                        disconnectWh.Set();
                    };

                    SetReconnectDelay(host.Transport, TimeSpan.FromSeconds(15));

                    connection.Start(host.Transport).Wait();                    

                    // Without this the connection start and reconnect can race with eachother resulting in a deadlock.
                    Thread.Sleep(TimeSpan.FromSeconds(3));

                    // Set reconnect window to zero so the second we attempt to reconnect we can ensure that the reconnect window is verified.
                    ((Client.IConnection)connection).ReconnectWindow = TimeSpan.FromSeconds(0);

                    host.Shutdown();

                    Assert.True(disconnectWh.Wait(TimeSpan.FromSeconds(15)), "Closed never fired");
                }
            }
        }
开发者ID:kietnha,项目名称:SignalR,代码行数:34,代码来源:ConnectionFacts.cs


注:本文中的TransportType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。