#!/usr/bin/env bash # Regenerate every file under docs/output/. Nothing to install beyond a JDK: every test starts an # embedded Tomcat on a random port and talks to it over a real socket. set -eu cd "$(dirname "$0")/.." LOG=/tmp/sse-websocket-test.log mvn -B test > "$LOG" 2>&1 # The buffer sweep: the same binary search at three container buffer sizes, so the ceiling can be # shown as a function of the setting rather than as one number. : > /tmp/sse-buffer-sweep.log for b in 16384 32768 65536; do mvn -B test -Dtest=StompSizeLimitTunedBufferTest -Dwsbuf="$b" 2>&1 \ | grep -E '^=== container buffer|^largest body|^smallest body' >> /tmp/sse-buffer-sweep.log done sed -n '/=== GET \/sse\/raw/,/^| 0$/p' "$LOG" > docs/output/sse-wire-format.txt sed -n '/=== SseEmitter.event()/,/=== String payload, APPLICATION_JSON/p' "$LOG" \ > docs/output/sse-payload-conversion.txt { sed -n '/=== GET \/sse\/silent/,/registry.timedOut/p' "$LOG" echo sed -n '/=== client closed the socket/,/appeared to succeed/p' "$LOG" } > docs/output/sse-lifecycle.txt sed -n '/=== server.tomcat.threads.max=10/,/clients that read it/p' "$LOG" \ > docs/output/sse-concurrency.txt grep -E '^=== spring.mvc.async|^\{"spring.mvc.async' "$LOG" > docs/output/async-timeout.txt { sed -n '/=== SEND \/app\/chat.send/,/^| DISCONNECT/p' "$LOG"; echo sed -n '/=== @MessageMapping/,/^subscribed to/p' "$LOG"; echo sed -n '/=== SEND straight to/,/did NOT happen/p' "$LOG"; echo sed -n '/^alice.getSessionId/,/^bob received/p' "$LOG" } > docs/output/stomp-routing.txt { echo "The limit that fires is the servlet container's WebSocket buffer, not Spring's" echo "messageSizeLimit. Body length below is the JSON string field; the STOMP frame carries" echo "about 90 bytes of headers on top." echo sed -n '/=== container buffer: Tomcat default/,/smallest body rejected/p' "$LOG" echo cat /tmp/sse-buffer-sweep.log echo sed -n '/=== bigframes profile/,/^200 KB body/p' "$LOG" \ | grep -vE '^\s+at |^2026-|^$|Initializing|Completed initialization' echo echo "Spring's own limit, once the container is out of the way:" grep -m1 -A1 'Failed to parse TextMessage' "$LOG" | sed 's/^\[[^]]*\] //' grep -m1 'STOMP buffer size limit' "$LOG" echo grep -oE '"ws.container.defaultMaxTextMessageBufferSize":[0-9]+' "$LOG" | sort -u } > docs/output/websocket-size-limits.txt sed -n '/=== GET \/ws handshake/,/Origin: https:\/\/evil/p' "$LOG" > docs/output/handshake-origin.txt grep -E 'Tests run:.*in com\.ankurm' "$LOG" | sed 's/^\[INFO\] //' > docs/output/tests.txt echo "regenerated:"; ls -1 docs/output/