You were quite near. The code should look like this:
terminal.SendToServer(New ConsoleKeyInfo(Chr(27), ConsoleKey.Escape, False, False, False))
It is because the
ConsoleKey.Escape value is not handled by the terminal explicitly, so the
ConsoleKeyInfo.KeyChar is used. Actually, it is easy to handle
ConsoleKey.Escape in terminal, so I will add this functionality. All your cases will work in the next release.
Basically, you want to send a string which contains two escapes. The easiest way is the following:
terminal.SendToServer(Chr(27) & Chr(27))