If you want to open a TN5250 terminal in Visual Studio Code and this error appears Could not start session: Connection refused :
-bash-5.2$ TERM=xterm /QOpenSys/pkgs/bin/tn5250 localhost
Could not start session: Connection refused
You can have ssh on HOST restricted only via ssl.
You can try another shot on ssh terminal but this time with ssl prefix :
tn5250 ssl:localhost
If it works then you can set this option in Terminal settings :