A comprehensive test server that supports all major HTTP-based protocols including PROXY Protocol v1 and v2.
✅ Protocol Support
- HTTP/1.1 and HTTP/2
- WebSocket
- Server-Sent Events (SSE)
- GraphQL
- gRPC
- Long Polling
- Chunked Transfer Encoding
- WebDAV
- PROXY Protocol v1 & v2
# Show all available commands
make help
# Quick start with Docker
make docker-run # Start all services
make docker-test # Run tests
make docker-stop # Stop services
# Local development
make build # Build binary
make run # Run locally
make test # Test local server# Build
chmod +x build-local.sh
./build-local.sh
# Run (choose based on your system)
./test-backend-darwin-arm64 # macOS M1/M2
./test-backend-darwin # macOS Intel
./test-backend-linux # Linux
# Test
chmod +x test-local.sh
./test-local.sh# Build image
docker build -t test-backend:latest .
# Run with docker-compose
docker-compose -f docker-compose.local.yaml up -d
# Run tests
./test-local.sh
# View logs
docker-compose -f docker-compose.local.yaml logs -f
# Stop
docker-compose -f docker-compose.local.yaml down| Port | Protocol | Description |
|---|---|---|
| 8080 | HTTP | Main server (HTTP/WebSocket/SSE/GraphQL) |
| 8081 | HTTP | PROXY Protocol listener |
| 50051 | gRPC | gRPC service |
| 8888 | HTTP | Nginx reverse proxy (docker-compose) |
| 8444 | HTTP | HAProxy with PROXY Protocol (docker-compose) |
curl http://localhost:8080/
curl -X POST http://localhost:8080/ -d "test=data"# With websocat
websocat ws://localhost:8080/ws
# With curl
curl -i -N \
-H "Connection: Upgrade" \
-H "Upgrade: websocket" \
-H "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
-H "Sec-WebSocket-Version: 13" \
http://localhost:8080/wscurl -N -H "Accept: text/event-stream" http://localhost:8080/eventscurl -X POST http://localhost:8080/graphql \
-H "Content-Type: application/json" \
-d '{"query":"{test}"}'curl http://localhost:8080/long-pollcurl --raw http://localhost:8080/chunkedcurl -X PROPFIND http://localhost:8080/dav/# Through HAProxy (docker-compose)
curl http://localhost:8444/proxy-v1/test # PROXY v1
curl http://localhost:8444/proxy-v2/test # PROXY v2
# Direct to PROXY port
curl http://localhost:8081/The server can detect which protocol is being used:
curl http://localhost:8080/detectView all test results collected during the session:
curl http://localhost:8080/test-results | jqtest-backend/
├── main.go # Main server code
├── go.mod # Go module definition
├── Dockerfile # Container image
├── Makefile # Build automation
├── build-local.sh # Local build script
├── test-local.sh # Test script
├── docker-compose.local.yaml # Local testing stack
├── nginx-test.conf # Nginx test config
├── haproxy-test.cfg # HAProxy test config
└── README.md # This file
- Add handler in
main.go - Register route in
setupRoutes() - Add test case in
test-local.sh - Update documentation
# Find process using port
lsof -i :8080
# Kill process
kill -9 <PID># Clean rebuild
docker-compose -f docker-compose.local.yaml down -v
docker-compose -f docker-compose.local.yaml build --no-cache- Ensure server is running:
curl http://localhost:8080/health - Check logs:
docker-compose logs test-backend - Verify ports are exposed:
docker ps
- Go 1.21+
- Docker & Docker Compose (optional)
- Test tools (optional):
websocat- WebSocket testinggrpcurl- gRPC testingjq- JSON processing
Install test tools:
make install-tools # macOS onlyMIT