Added test for session_close

live
noah metz 2024-04-07 13:29:17 -06:00
parent 900b7502a9
commit 6c2fb20b1c
1 changed files with 23 additions and 0 deletions

@ -110,3 +110,26 @@ func TestSessionData(t *testing.T) {
t.Fatalf("Parsed message(%s) != test message(%s)", parsed_message, message) t.Fatalf("Parsed message(%s) != test message(%s)", parsed_message, message)
} }
} }
func TestSessionClose(t *testing.T) {
_, client_key, err := ed25519.GenerateKey(rand.Reader)
fatalErr(t, err)
_, server_key, err := ed25519.GenerateKey(rand.Reader)
fatalErr(t, err)
client_so, client_ecdh, err := NewSessionOpen(client_key)
fatalErr(t, err)
server_so, server_ecdh, err := NewSessionOpen(server_key)
fatalErr(t, err)
server_session, err := ParseSessionOpen(server_ecdh, client_so[COMMAND_LENGTH:])
fatalErr(t, err)
client_session, err := ParseSessionOpen(client_ecdh, server_so[COMMAND_LENGTH:])
fatalErr(t, err)
session_close := NewSessionClose(&client_session)
fatalErr(t, ParseSessionClose(&server_session, session_close[COMMAND_LENGTH+ID_LENGTH:]))
}