Expand description
Utilities for mocking at the socket level
Other tools in this module actually operate at the http::Request / http::Response level. This
is useful, but it shortcuts the HTTP implementation (e.g. Hyper). WireMockServer binds
to an actual socket on the host.
§Examples
use aws_smithy_runtime_api::client::http::HttpConnectorSettings;
use aws_smithy_http_client::test_util::wire::{check_matches, ReplayedEvent, WireMockServer};
use aws_smithy_http_client::{match_events, ev};
// This connection binds to a local address
let mock = WireMockServer::start(vec![
    ReplayedEvent::status(503),
    ReplayedEvent::status(200)
]).await;
// Create a client using the wire mock
let config = my_generated_client::Config::builder()
    .http_client(mock.http_client())
    .build();
let client = Client::from_conf(config);
// ... do something with <client>
// assert that you got the events you expected
match_events!(ev!(dns), ev!(connect), ev!(http(200)))(&mock.events());Macros§
- ev
 - Helper to generate match expressions for events
 - match_
events  - Helper macro to generate a series of test expectations
 - matcher
 
Structs§
- Logging
DnsResolver  - DNS resolver that keeps a log of all lookups
 - Wire
Mock Server  - Test server that binds to 127.0.0.1:0
 
Enums§
- Recorded
Event  - An event recorded by 
WireMockServer. - Replayed
Event  
Functions§
- check_
matches  - This method should only be used by the macro