File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33set -e
44HOST=" ${1:- localhost} "
55PORT=49152
6- TIMEOUT=3
6+ TIMEOUT=5
77
88echo " [test] Checking port $PORT on $HOST ..."
99
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22# Test: Start a telnet connection to port 49152 and verify banner response
3+ # The server uses a polling loop (500ms) + session handler to send banner.
4+ # The ConnectionPoller needs to poll CURRENT_CONNECTIONS before greet() fires.
5+ # Keep stdin open with sleep so the server has time to respond.
36set -e
47HOST=" ${1:- localhost} "
58PORT=49152
6- TIMEOUT=5
9+ TIMEOUT=12
710
8- echo " [test] Connecting to $HOST :$PORT ..."
11+ echo " [test] Connecting to $HOST :$PORT (waiting up to ${TIMEOUT} s for banner) ..."
912
10- RESPONSE=$( echo " " | timeout " $TIMEOUT " nc -w " $TIMEOUT " " $HOST " " $PORT " 2> /dev/null || true)
13+ RESPONSE=$( (sleep " $TIMEOUT " ) | timeout " $TIMEOUT " nc -w " $TIMEOUT " " $HOST " " $PORT " 2> /dev/null | head -20 || true)
1114
12- if [ -n " $RESPONSE " ]; then
15+ if echo " $RESPONSE " | grep -qi " N21\|NATIONAL\|FINANCE\|Welcome" ; then
16+ echo " [PASS] Connection established. Server banner received:"
17+ echo " $RESPONSE " | head -10
18+ exit 0
19+ elif [ -n " $RESPONSE " ]; then
1320 echo " [PASS] Connection established. Server response:"
1421 echo " $RESPONSE " | head -10
1522 exit 0
You can’t perform that action at this time.
0 commit comments