use anytls::core::{Command, Engine, Frame, PaddingFactory, ProtocolAction, State};
#[test]
fn engine_accepts_v2_settings_and_echoes_serversettings() {
let state = State::new(PaddingFactory::default());
let data = b"v=2".to_vec();
let frame = Frame::with_data(Command::Settings, 0, bytes::Bytes::copy_from_slice(&data));
let actions = Engine::on_frame(&state, false, &frame).expect("Engine::on_frame failed");
assert_eq!(state.peer_version(), 2);
let mut found = false;
for action in actions {
if let ProtocolAction::SendFrameSync(f) = action
&& f.cmd == Command::ServerSettings
&& f.data.as_ref().windows(3).any(|w| w == b"v=2")
{
found = true;
}
}
assert!(found, "Expected ServerSettings with v=2 in actions");
}