Add test infrastructure to work directly with frames (#56)

This adds a `Codec` based testing API. This is a bit less annoying than writing
at the raw H2 wire protocol level...
This commit is contained in:
Carl Lerche
2017-09-06 14:18:37 -07:00
committed by GitHub
parent 711086c184
commit cd76aca6d4
17 changed files with 601 additions and 222 deletions

View File

@@ -12,6 +12,13 @@ pub struct Ping {
}
impl Ping {
pub fn new() -> Ping {
Ping {
ack: false,
payload: Payload::default(),
}
}
pub fn pong(payload: Payload) -> Ping {
Ping { ack: true, payload }
}
@@ -20,6 +27,11 @@ impl Ping {
self.ack
}
#[cfg(feature = "unstable")]
pub fn payload(&self) -> &Payload {
&self.payload
}
pub fn into_payload(self) -> Payload {
self.payload
}