Exemplo n.º 1
0
    public void TestThatSecureClientReceivesResponseFromRequestProbeActor()
    {
        var clientConsumer = new TestSecureResponseChannelConsumer();
        var access         = clientConsumer.AfterCompleting(1);
        var unknown        = new UnknownResponseConsumer(access, _output);

        var config =
            Client.Configuration.Secure(
                _world.Stage,
                Address.From(Host.Of("webhook.site"), 443, AddressType.None),
                unknown,
                false,
                10,
                65535,
                10,
                65535);

        config.TestInfo(true);

        var requestSender = _world.Stage.ActorFor <IRequestSender>(() => new RequestSenderProbeActor(config, clientConsumer, "1"));

        var get    = "GET /4f0931bb-1c2f-4786-a703-a8b86419c03d HTTP/1.1\nHost: webhook.site\nConnection: close\n\n";
        var buffer = BasicConsumerByteBuffer.Allocate(1, 1000);

        buffer.Put(Encoding.UTF8.GetBytes(get));
        buffer.Flip();

        requestSender.SendRequest(Request.From(buffer));

        Assert.Equal(1, access.ReadFrom <int>("consumeCount"));

        Assert.Contains("HTTP/1.1 404 Not Found", clientConsumer.GetResponses().First());
    }
    public SecureClientRequestResponseChannelTest(ITestOutputHelper output)
    {
        var converter = new Converter(output);

        Console.SetOut(converter);

        _world = World.StartWithDefaults("test-request-response-channel");

        _clientConsumer = new TestSecureResponseChannelConsumer();
    }