#/bin/bash
# Test basic argument handling.
# This implements T2 in the original test plan.
. common.sh
set +o errexit

$HITCH $HITCH_ARGS --backend=[hitch-tls.org]:80 "--frontend=[${LISTENADDR}]:$LISTENPORT" certs/site1.example.com
test "$?" = "0" || die "Hitch did not start."

echo -e "\n" | openssl s_client -prexit -connect $LISTENADDR:$LISTENPORT 2>/dev/null > $DUMPFILE
test "$?" = "0" || die "s_client failed"

grep -q -c "subject=/CN=site1.example.com" $DUMPFILE
test "$?" = "0" || die "Got wrong certificate."

runcurl $LISTENADDR $LISTENPORT
