@@ -55,6 +55,9 @@ public class MaxFrameSizeEnabledTest {
5555 private static final int CONNECTION_COUNT = 3 ;
5656 private static final int MESSAGE_ATTEMPTS = 3 ;
5757 private static final int BODY_SIZE = 20000 ; // large enough to trip 2k limit, compressible enough for 60k
58+ private static final long BROKER_START_TIMEOUT_MS = 30_000 ;
59+ private static final long BROKER_STOP_TIMEOUT_MS = 30_000 ;
60+ private static final int TEST_TIMEOUT_MS = 120_000 ;
5861
5962 private BrokerService broker ;
6063 private final String transportType ;
@@ -158,30 +161,32 @@ public void after() throws Exception {
158161 }
159162
160163 public BrokerService createBroker (String connectorName , String connectorString ) throws Exception {
161- BrokerService broker = new BrokerService ();
164+ final BrokerService broker = new BrokerService ();
162165 broker .setPersistent (false );
163166 broker .setUseJmx (false );
164- TransportConnector connector = broker .addConnector (connectorString );
167+ final TransportConnector connector = broker .addConnector (connectorString );
165168 connector .setName (connectorName );
166169 broker .start ();
167- broker .waitUntilStarted ();
170+ assertTrue ("Broker should start within timeout" ,
171+ Wait .waitFor (broker ::isStarted , BROKER_START_TIMEOUT_MS , 100 ));
168172 return broker ;
169173 }
170174
171175 public void stopBroker (BrokerService broker ) throws Exception {
172176 if (broker != null ) {
173177 broker .stop ();
174- broker .waitUntilStopped ();
178+ assertTrue ("Broker should stop within timeout" ,
179+ Wait .waitFor (broker ::isStopped , BROKER_STOP_TIMEOUT_MS , 100 ));
175180 }
176181 }
177182
178- @ Test
183+ @ Test ( timeout = TEST_TIMEOUT_MS )
179184 public void testMaxFrameSize () throws Exception {
180185 broker = createBroker (transportType , transportType + "://localhost:0?wireFormat.maxFrameSize=2048" + getServerParams ());
181186 testMaxFrameSize (transportType , getClientUri (broker .getConnectorByName (transportType ).getConnectUri ().getPort ()), false );
182187 }
183188
184- @ Test
189+ @ Test ( timeout = TEST_TIMEOUT_MS )
185190 public void testMaxFrameSizeCompression () throws Exception {
186191 // Test message body length is 99841 bytes. Compresses to ~ 48000
187192 broker = createBroker (transportType , transportType + "://localhost:0?wireFormat.maxFrameSize=60000" + getServerParams ());
0 commit comments