You can use:
echo "<sudo password>" | sudo -S sh -c "echo \"<openconnect password\" | openconnect server --user=username --passwd-on-stdin --no-cert-check"
replacing with the password needed for root and with your openconnect password.
This should work because you first pipe in the sudo password to sudo itself (using -S as per your linked question, to take in the password via stdin) and then executing (as root) another command - this is what sh -c does (when followed by a string that is your command). We append our command to sh -c which includes piping in the openconnect password to openconnect - at this point, openconnect is working as root and so doesn't need sudo before it.
While I don't use openconnect, I tested with echo "mypassword" | sudo -S sh -c "whoami | xargs -i echo {} to test piping the value from whoami which tells me root, confirming the sudo works. You may get a line into stdout (your terminal) stating to enter in the password, but it will still work - you can ignore this line if you specified it in stdin.