diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-08 22:19:34 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-08 22:20:04 +0300 |
| commit | 793f127e54dd5f2cfb78922470b7efcb74a1fa5e (patch) | |
| tree | df9a925c7d4dc4be64ffd77cf5dfe3e5abb273a0 /tests/server_headless.rs | |
| parent | bb0dad86f81768c8b7d5894acf7cd53bd05d302b (diff) | |
feat(remote): add network-efficient thin client transport
Add SSH stdio remote attach, negotiate terminal-ANSI render encoding, move blit encoding server-side for remote clients, and split control/render writer delivery for safer backpressure.
Fixes #76
Diffstat (limited to 'tests/server_headless.rs')
| -rw-r--r-- | tests/server_headless.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/server_headless.rs b/tests/server_headless.rs index 687b886b..33a3fa7f 100644 --- a/tests/server_headless.rs +++ b/tests/server_headless.rs @@ -169,6 +169,7 @@ fn client_handshake( &encode_varint_u32(version), &encode_varint_u16(cols), &encode_varint_u16(rows), + &encode_varint_u32(0), // RenderEncoding::SemanticFrame ], ); let framed = frame_message(&hello_payload); @@ -310,6 +311,10 @@ fn decode_welcome(payload: &[u8]) -> Result<(u32, Option<String>), String> { let (version, consumed) = decode_varint_u32(payload, offset)?; offset += consumed; + // encoding: RenderEncoding + let (_encoding, consumed) = decode_varint_u32(payload, offset)?; + offset += consumed; + // error: Option<String> — discriminant is always 1 byte if offset >= payload.len() { return Err("payload too short for Option tag".into()); @@ -576,11 +581,11 @@ fn client_handshake_succeeds() { // Connect to the client socket and perform a handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); - // Send Hello with version 2, 80 cols, 24 rows. + // Send Hello with version 4, 80 cols, 24 rows. let (version, error) = - client_handshake(&mut stream, 3, 80, 24).expect("handshake should succeed"); + client_handshake(&mut stream, 4, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 3, "server should report protocol version 3"); + assert_eq!(version, 4, "server should report protocol version 4"); assert!( error.is_none(), "handshake should not have an error: {:?}", @@ -609,7 +614,7 @@ fn client_handshake_rejects_incompatible_version() { let (version, error) = client_handshake(&mut stream, 0, 80, 24) .expect("should read Welcome response even on rejection"); - assert_eq!(version, 3, "server should report its version 3"); + assert_eq!(version, 4, "server should report its version 4"); assert!( error.is_some(), "version 0 should be rejected with an error" @@ -634,10 +639,10 @@ fn client_handshake_clamps_small_terminal_size() { // Send Hello with 0x0 terminal size — should be clamped. let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); - let (version, error) = client_handshake(&mut stream, 3, 0, 0) + let (version, error) = client_handshake(&mut stream, 4, 0, 0) .expect("handshake with 0x0 should succeed (server clamps)"); - assert_eq!(version, 3); + assert_eq!(version, 4); assert!( error.is_none(), "0x0 size should be accepted (clamped): {:?}", @@ -697,9 +702,9 @@ fn no_hello_client_closed_within_five_seconds() { // Verify the server is still healthy — a proper client can still connect. let mut good_stream = UnixStream::connect(&client_socket).expect("should connect after no-hello client"); - let (version, error) = client_handshake(&mut good_stream, 3, 80, 24) + let (version, error) = client_handshake(&mut good_stream, 4, 80, 24) .expect("proper handshake should still work after no-hello client"); - assert_eq!(version, 3); + assert_eq!(version, 4); assert!(error.is_none()); // API should still work. |
