! This will test RMIF when SERVER is KILLed and RESTARTed
!
! Test Scenario
!     Start Server
!     Start Client
!     Kill Server
!     Start Server
!     Client reopens connection to server
!     Server sends GET message to client (after OPEN message)
!     Client responds with RET message to server
!
! <sPort>     - The KNOWN port of the server.  Client uses any available port.
! <timeout>   - Timeout for this test case to run (seconds)
!
! @author  Jay Hallam / Neon Ngo
! @bug 1541 & 1631: Reopen not quite right/restarting a remote
!
startmacro L:sPort[-1] D:timeout[15]
  switch DEBUG         debug        GET DEF=false    SDEF=true
  switch DEBUGSERVER   debugs       GET DEF=^debug   SDEF=true
  switch DEBUGCLIENT   debugc       GET DEF=^debug   SDEF=true
  switch VERBOSE       verbose      GET DEF=false    SDEF=true
  switch VERBOSESERVER verboses     GET DEF=^verbose SDEF=true
  switch VERBOSECLIENT verbosec     GET DEF=^verbose SDEF=true
  switch STATEM        statemachine GET DEF=false    SDEF=true

  timer set

  if statemachine then
    warn "^reg.main.name test is skipped in /STATEM mode, as hard kill leaves the server in a state where &
           the server rejects incoming packet as 'unsolicited'"
  else

    call standardSetup timeout sPort
    pipe on
      %test_rmif_kill_server/id=SERVER/STATEM=^statemachine/DEBUG=^debugs/VERBOSE=^verboses/BG this ^sPort
      %test_rmif_kill_client/id=CLIENT/STATEM=^statemachine/DEBUG=^debugc/VERBOSE=^verbosec/BG this ^sPort
    pipe off

    timer elapse
  endif
endmacro

!******************************************************************************!
procedure processMessage m:msg
  if debug then
    say "^reg.main.name: Got message name=^msg.name fid=^msg.fid info=^msg.info data=^msg.data"
  endif

  if false then ! Your message name goes here
    !
    ! Your message(s) processing goes here
    !
  else
    call processStandardMessages
  endif
return

! These are a set of standard procedures
include standard_rmif_procs.mminc
