parent
552e4a2844
commit
51f105da7b
|
@ -69,29 +69,33 @@ public class StompWithLargeMessagesTest extends StompTestBase {
|
||||||
public void testSendReceiveLargeMessage() throws Exception {
|
public void testSendReceiveLargeMessage() throws Exception {
|
||||||
StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
|
StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
|
||||||
|
|
||||||
String address = "testLargeMessageAddress";
|
try {
|
||||||
server.getActiveMQServer().createQueue(SimpleString.toSimpleString(address), RoutingType.ANYCAST, SimpleString.toSimpleString(address), null, true, false);
|
String address = "testLargeMessageAddress";
|
||||||
|
server.getActiveMQServer().createQueue(SimpleString.toSimpleString(address), RoutingType.ANYCAST, SimpleString.toSimpleString(address), null, true, false);
|
||||||
|
|
||||||
// STOMP default is UTF-8 == 1 byte per char.
|
// STOMP default is UTF-8 == 1 byte per char.
|
||||||
int largeMessageStringSize = 10 * 1024 * 1024; // 10MB
|
int largeMessageStringSize = 10 * 1024 * 1024; // 10MB
|
||||||
StringBuilder b = new StringBuilder(largeMessageStringSize);
|
StringBuilder b = new StringBuilder(largeMessageStringSize);
|
||||||
for (int i = 0; i < largeMessageStringSize; i++) {
|
for (int i = 0; i < largeMessageStringSize; i++) {
|
||||||
b.append('t');
|
b.append('t');
|
||||||
|
}
|
||||||
|
String payload = b.toString();
|
||||||
|
|
||||||
|
// Set up STOMP subscription
|
||||||
|
conn.connect(defUser, defPass);
|
||||||
|
subscribe(conn, null, Stomp.Headers.Subscribe.AckModeValues.AUTO, null, null, address, true);
|
||||||
|
|
||||||
|
// Send Large Message
|
||||||
|
System.out.println("Sending Message Size: " + largeMessageStringSize);
|
||||||
|
send(conn, address, null, payload);
|
||||||
|
|
||||||
|
// Receive STOMP Message
|
||||||
|
ClientStompFrame frame = conn.receiveFrame();
|
||||||
|
System.out.println(frame.getBody().length());
|
||||||
|
assertTrue(frame.getBody().equals(payload));
|
||||||
|
} finally {
|
||||||
|
conn.disconnect();
|
||||||
}
|
}
|
||||||
String payload = b.toString();
|
|
||||||
|
|
||||||
// Set up STOMP subscription
|
|
||||||
conn.connect(defUser, defPass);
|
|
||||||
subscribe(conn, null, Stomp.Headers.Subscribe.AckModeValues.AUTO, null, null, address, true);
|
|
||||||
|
|
||||||
// Send Large Message
|
|
||||||
System.out.println("Sending Message Size: " + largeMessageStringSize);
|
|
||||||
send(conn, address, null, payload);
|
|
||||||
|
|
||||||
// Receive STOMP Message
|
|
||||||
ClientStompFrame frame = conn.receiveFrame();
|
|
||||||
System.out.println(frame.getBody().length());
|
|
||||||
assertTrue(frame.getBody().equals(payload));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//stomp sender -> large -> stomp receiver
|
//stomp sender -> large -> stomp receiver
|
||||||
|
|
Loading…
Reference in New Issue