def interact_in_memory(client_conn, server_conn):
wrote = True<EOL>while wrote:<EOL><INDENT>wrote = False<EOL>for (read, write) in [(client_conn, server_conn),<EOL>(server_conn, client_conn)]:<EOL><INDENT>try:<EOL><INDENT>data = read.recv(<NUM_LIT:2> ** <NUM_LIT:16>)<EOL><DEDENT>except WantReadError:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>return (read, data)<EOL><DEDENT>while True:<EOL><INDENT>try:<EOL><INDENT>dirty = read.bio_read(<NUM_LIT>)<EOL><DEDENT>except WantReadError:<EOL><INDENT>break<EOL><DEDENT>else:<EOL><INDENT>wrote = True<EOL>write.bio_write(dirty)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Try to read application bytes from each of the two `Connection` objects.
Copy bytes back and forth between their send/receive buffers for as long
as there is anything to copy.  When there is nothing more to copy,
return `None`.  If one of them actually manages to deliver some application
bytes, return a two-tuple of the connection from which the bytes were read
and the bytes themselves.