#!/bin/bash

#PROF="qprof -i 1000"
STUNNEL="/usr/local/sbin/stunnel"

$PROF $STUNNEL -fd 10 10<<EOT 2>cli.log &
foreground=yes
debug=4
pid=
[s1]
ciphers=RC4-MD5
client=yes
accept=50000
connect=50001
EOT
CLIPID=$!

$PROF $STUNNEL -fd 10 10<<EOT 2>srv.log &
foreground=yes
debug=4
pid=
[s2]
ciphers=RC4-MD5
session=1
accept=50001
connect=50002
EOT
SRVPID=$!

./tcpsrv &
TCPSRVPID=$!

sleep 1
./tcpcli

disown -a
kill $CLIPID $SRVPID $TCPSRVPID
wait

