*** Settings ***
Library     my_handler.py
Resource        ../Protocols.txt
Suite Setup     Setup protocol, TCP server, and client
Test teardown    Teardown rammbock and increment port numbers
#Default tags    regression

*** Test cases ***
Register an auto reply
    Define sample template
    Set client handler  handle_sample
    Server sends sample message
    Server sends another message
    Client receives another message
    Handler should have been called with sample message
*** Settings ***
Library     my_handler.py
Resource        ../Protocols.txt
Suite Setup     Setup protocol, TCP server, and client
Test teardown    Teardown rammbock and increment port numbers
#Default tags    regression

*** Test cases ***
Register an auto reply
    Define Templates
    Load Template   sample
    Set client handler  my_handler.handle_sample
    Server sends sample message
    Server sends another message
    Client receives another message
    Handler should have been called with sample message

*** Keywords ***
Define Templates
    Define sample template
    Define another template
Define sample template
    New Message     sample  Example     header:messageType:0x0042
    u16     foo     1
    Save Template   sample
Define another template
    New Message     sample  Example     header:messageType:0x00ab
    u16     foo     100
    u16     eoo      500
    Save Template   another
Server sends sample message
    Load Template   sample
    Server sends message
Server sends another message
    Load Template   another
    Server sends message
Client receives another message
    Load Template   another
    Client receives message   header_filter=messageType
Handler should have been called with sample message
    ${rcvd msgs}   Get rcvd msg
    Length should be   ${rcvd_msgs}     1
    ${msg}=    Set variable   ${rcvd msgs[0]}
    Should be equal   ${msg._header.messageType.hex}     0x0042
Test Case for Asynchronous message handling
Test Case for Asynchronous message handling
