<s> import time <EOL> import unittest <EOL> import stomp <EOL> from stomp . listener import TestListener <EOL> from stomp . test . testutils import * <EOL> class Test10Connect ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> conn = stomp . Connection10 ( get_default_host ( ) ) <EOL> listener = TestListener ( '<STR_LIT>' ) <EOL> conn . set_listener ( '<STR_LIT>' , listener ) <EOL> conn . start ( ) <EOL> conn . connect ( get_default_user ( ) , get_default_password ( ) , wait = True ) <EOL> self . conn = conn <EOL> self . listener = listener <EOL> self . timestamp = time . strftime ( '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> if self . conn : <EOL> self . conn . disconnect ( receipt = None ) <EOL> def testsend10 ( self ) : <EOL> queuename = '<STR_LIT>' % self . timestamp <EOL> self . conn . subscribe ( destination = queuename , ack = '<STR_LIT>' ) <EOL> self . conn . send ( body = '<STR_LIT>' , destination = queuename , receipt = '<STR_LIT>' ) <EOL> self . listener . wait_for_message ( ) <EOL> self . assertTrue ( self . listener . connections == <NUM_LIT:1> , '<STR_LIT>' ) <EOL> self . assertTrue ( self . listener . messages == <NUM_LIT:1> , '<STR_LIT>' ) <EOL> self . assertTrue ( self . listener . errors == <NUM_LIT:0> , '<STR_LIT>' ) <EOL> def testclientack10 ( self ) : <EOL> queuename = '<STR_LIT>' % self . timestamp <EOL> self . conn . subscribe ( destination = queuename , id = <NUM_LIT:1> , ack = '<STR_LIT>' ) <EOL> self . conn . send ( body = '<STR_LIT>' , destination = queuename ) <EOL> self . listener . wait_for_message ( ) <EOL> ( headers , _ ) = self . listener . get_latest_message ( ) <EOL> message_id = headers [ '<STR_LIT>' ] <EOL> self . conn . ack ( message_id ) <EOL> time . sleep ( <NUM_LIT:1> ) </s>
