Skip to content

Commit

Permalink
Remove STOMP relay integration test
Browse files Browse the repository at this point in the history
The test was verifying that when a DISCONNECT frame is sent to the
broker, there will be no further messages on the clientOutboundChannel.

This is generally true, however in some cases when the broker receives
a DISCONNECT it may close its connection fast enough (before we do) in
which case we send an ERROR message downstream to ensure the WebSocket
side is cleaned up. Either way the downstream should be idempotent
with regards to cleaning up sessions.
  • Loading branch information
rstoyanchev committed Jan 6, 2015
1 parent 8a47c18 commit f59fc83
Showing 1 changed file with 3 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.messaging.Message;
Expand All @@ -49,7 +48,9 @@
import org.springframework.util.Assert;
import org.springframework.util.SocketUtils;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

/**
* Integration tests for {@link StompBrokerRelayMessageHandler} running against ActiveMQ.
Expand Down Expand Up @@ -229,25 +230,6 @@ public void relayReconnectsIfBrokerComesBackUp() throws Exception {
this.eventPublisher.expectBrokerAvailabilityEvent(true);
}

@Test
public void disconnectClosesRelaySessionCleanly() throws Exception {

logger.debug("Starting test disconnectClosesRelaySessionCleanly()");

MessageExchange connect = MessageExchangeBuilder.connect("sess1").build();
this.relay.handleMessage(connect.message);
this.responseHandler.expectMessages(connect);

StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.DISCONNECT);
headers.setSessionId("sess1");
this.relay.handleMessage(MessageBuilder.createMessage(new byte[0], headers.getMessageHeaders()));

Thread.sleep(2000);

// Check that we have not received an ERROR as a result of the connection closing
assertTrue("Unexpected messages: " + this.responseHandler.queue, this.responseHandler.queue.isEmpty());
}

@Test
public void disconnectWithReceipt() throws Exception {

Expand Down

0 comments on commit f59fc83

Please sign in to comment.