I am trying to use socat command to simulate a tcp disconnect between my client service and EMS broker process on a remote host. I am running this socat command
socat TCP-LISTEN:8123,fork TCP:remotehost name:port
I run this command on a server say server1 - and I am configuring my client service to connect to server1:8123 - which enables client to be able to connect to the actual EMS broker.
However - when I want to simulate a disconnection - I am killing the socat process ( i find the pid by ps aux | grep socat ) - but that does not seem to kill the connection - I can see that client is still able to talk to the ems broker. ( why is socat not killed at this stage ? )
However - If I now restart my client then it fails connecting to broker ( because now the socat process is really dead ).
I cant figure out whats happening here - how can I ensure that socat process is definitely killed ?