<s> from socket import socket <EOL> from threading import Thread <EOL> from OpenSSL . SSL import Connection , Context , TLSv1_METHOD <EOL> def send ( conn ) : <EOL> while <NUM_LIT:1> : <EOL> for i in xrange ( <NUM_LIT> * <NUM_LIT:32> ) : <EOL> conn . send ( '<STR_LIT:x>' ) <EOL> print '<STR_LIT>' , hex ( id ( conn ) ) <EOL> def recv ( conn ) : <EOL> while <NUM_LIT:1> : <EOL> for i in xrange ( <NUM_LIT> * <NUM_LIT:64> ) : <EOL> conn . recv ( <NUM_LIT:1> ) <EOL> print '<STR_LIT>' , hex ( id ( conn ) ) <EOL> def main ( ) : <EOL> port = socket ( ) <EOL> port . bind ( ( '<STR_LIT>' , <NUM_LIT:0> ) ) <EOL> port . listen ( <NUM_LIT:5> ) <EOL> client = socket ( ) <EOL> client . setblocking ( False ) <EOL> client . connect_ex ( port . getsockname ( ) ) <EOL> client . setblocking ( True ) <EOL> server = port . accept ( ) [ <NUM_LIT:0> ] <EOL> clientCtx = Context ( TLSv1_METHOD ) <EOL> clientCtx . set_cipher_list ( '<STR_LIT>' ) <EOL> clientCtx . load_tmp_dh ( '<STR_LIT>' ) <EOL> sslClient = Connection ( clientCtx , client ) <EOL> sslClient . set_connect_state ( ) <EOL> serverCtx = Context ( TLSv1_METHOD ) <EOL> serverCtx . set_cipher_list ( '<STR_LIT>' ) <EOL> serverCtx . load_tmp_dh ( '<STR_LIT>' ) <EOL> sslServer = Connection ( serverCtx , server ) <EOL> sslServer . set_accept_state ( ) <EOL> t1 = Thread ( target = send , args = ( sslClient , ) ) <EOL> t2 = Thread ( target = send , args = ( sslServer , ) ) <EOL> t3 = Thread ( target = recv , args = ( sslClient , ) ) <EOL> t4 = Thread ( target = recv , args = ( sslServer , ) ) <EOL> t1 . start ( ) <EOL> t2 . start ( ) <EOL> t3 . start ( ) <EOL> t4 . start ( ) <EOL> t1 . join ( ) <EOL> t2 . join ( ) <EOL> t3 . join ( ) <EOL> t4 . join ( ) <EOL> main ( ) </s>
