コード例 #1
0
ファイル: TestEnvironment.cs プロジェクト: xljiulang/MQTTnet
        public async Task <IMqttServer> StartServerAsync(MqttServerOptionsBuilder options)
        {
            if (Server != null)
            {
                throw new InvalidOperationException("Server already started.");
            }

            Server = new TestServerWrapper(_mqttFactory.CreateMqttServer(_serverLogger), TestContext, this);
            await Server.StartAsync(options.WithDefaultEndpointPort(ServerPort).Build());

            return(Server);
        }
コード例 #2
0
ファイル: TestEnvironment.cs プロジェクト: zaksnet/MQTTnet
        public async Task <IMqttServer> StartServerAsync(MqttServerOptionsBuilder options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (Server != null)
            {
                throw new InvalidOperationException("Server already started.");
            }

            Server = new TestServerWrapper(_mqttFactory.CreateMqttServer(ServerLogger), TestContext, this);

            options.WithDefaultEndpointPort(ServerPort);
            options.WithMaxPendingMessagesPerClient(int.MaxValue);

            await Server.StartAsync(options.Build()).ConfigureAwait(false);

            return(Server);
        }