<s> from subprocess import Popen <EOL> from test_common import * <EOL> import socket , ssl <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> ghostunnel = None <EOL> try : <EOL> root = RootCert ( '<STR_LIT:root>' ) <EOL> root . create_signed_cert ( '<STR_LIT>' ) <EOL> root . create_signed_cert ( '<STR_LIT>' ) <EOL> root . create_signed_cert ( '<STR_LIT>' , san = "<STR_LIT>" ) <EOL> other_root = RootCert ( '<STR_LIT>' ) <EOL> other_root . create_signed_cert ( '<STR_LIT>' ) <EOL> ghostunnel = run_ghostunnel ( [ '<STR_LIT>' , '<STR_LIT>' . format ( LOCALHOST ) , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' . format ( LOCALHOST , STATUS_PORT ) ] ) <EOL> pair = SocketPair ( TcpClient ( <NUM_LIT> ) , TlsServer ( '<STR_LIT>' , '<STR_LIT:root>' , <NUM_LIT> ) ) <EOL> pair . validate_can_send_from_client ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> pair . validate_can_send_from_server ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> pair . validate_closing_client_closes_server ( "<STR_LIT>" ) <EOL> try : <EOL> pair = SocketPair ( TcpClient ( <NUM_LIT> ) , TlsServer ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> ) ) <EOL> raise Exception ( '<STR_LIT>' ) <EOL> except ssl . SSLError : <EOL> print_ok ( "<STR_LIT>" ) <EOL> try : <EOL> pair = SocketPair ( TcpClient ( <NUM_LIT> ) , TlsServer ( '<STR_LIT>' , '<STR_LIT:root>' , <NUM_LIT> ) ) <EOL> raise Exception ( '<STR_LIT>' ) <EOL> except ssl . SSLError : <EOL> print_ok ( "<STR_LIT>" ) <EOL> print_ok ( "<STR_LIT:OK>" ) <EOL> finally : <EOL> terminate ( ghostunnel ) </s>
