Buggy code:
@ RunWith ( Parameterized . class ) public class StompWebSocketIntegrationTests extends AbstractWebSocketIntegrationTests { @ Parameters public static Iterable < Object [ ] > arguments ( ) { } @ Override protected Class < ? > [ ] getAnnotatedConfigClasses ( ) { } @ Test public void sendMessageToController ( ) throws Exception { TextMessage message = create ( SEND ) . headers ( "destination://app//simple" ) . build ( ) ; WebSocketSession session = doHandshake ( new StompWebSocketIntegrationTests . TestClientWebSocketHandler ( 0 , message ) , "//ws" ) . get ( ) ; StompWebSocketIntegrationTests . SimpleController controller = this . wac . getBean ( StompWebSocketIntegrationTests . SimpleController . class ) ; try { <START_BUG> assertTrue ( controller . latch . await ( 2 , TimeUnit . SECONDS ) ) ; <END_BUG> } finally { session . close ( ) ; } } @ Test public void sendMessageToControllerAndReceiveReplyViaTopic ( ) throws Exception { } @ Test public void sendMessageToBrokerAndReceiveReplyViaTopic ( ) throws Exception { } @ StompWebSocketIntegrationTests . IntegrationTestController static class SimpleController { private CountDownLatch latch = new CountDownLatch ( 1 ) ; @ MessageMapping ( "//simple" ) public void handle ( ) { } @ MessageMapping ( "//exception" ) public void handleWithError ( ) { } @ MessageExceptionHandler public void handleException ( IllegalArgumentException ex ) { } } @ StompWebSocketIntegrationTests . IntegrationTestController static class IncrementController { @ MessageMapping ( "//increment" ) public int handle ( int i ) { } } private static class TestClientWebSocketHandler extends TextWebSocketHandler { private final TextMessage [ ] messagesToSend ; private final int expected ; private final List < TextMessage > actual = new CopyOnWriteArrayList < > ( ) ; private final CountDownLatch latch ; public TestClientWebSocketHandler ( int expectedNumberOfMessages , TextMessage ... messagesToSend ) { } @ Override public void afterConnectionEstablished ( WebSocketSession session ) throws Exception { } @ Override protected void handleTextMessage ( WebSocketSession session , TextMessage message ) throws Exception { } } @ Configuration @ ComponentScan ( basePackageClasses = StompWebSocketIntegrationTests . class , useDefaultFilters = false , includeFilters = @ ComponentScan . Filter ( StompWebSocketIntegrationTests . IntegrationTestController . class ) ) static class TestMessageBrokerConfigurer extends AbstractWebSocketMessageBrokerConfigurer { @ Autowired private HandshakeHandler handshakeHandler ; @ Override public void registerStompEndpoints ( StompEndpointRegistry registry ) { } @ Override public void configureMessageBroker ( MessageBrokerRegistry configurer ) { } } @ Configuration static class TestMessageBrokerConfiguration extends DelegatingWebSocketMessageBrokerConfiguration { @ Override @ Bean public AbstractSubscribableChannel clientInboundChannel ( ) { } @ Override @ Bean public AbstractSubscribableChannel clientOutboundChannel ( ) { } } @ Target ( { ElementType . TYPE } ) @ Retention ( RetentionPolicy . RUNTIME ) @ Controller private @ interface IntegrationTestController { } }

Fix:
assertTrue ( controller . latch . await ( 10 , TimeUnit . SECONDS ) ) ;