This project demonstrates HTTP/3 bidirectional streaming using Netty (Java) and aioquic (Python). It features a Java server that processes incoming data packets asynchronously and slowly to demonstrate flow control and bidirectional communication, with both Java and Python client implementations.
- ✅ HTTP/3 & QUIC: Full HTTP/3 bidirectional streaming.
- ✅ Cross-Language: Java Server with both Java and Python clients.
- ✅ Asynchronous Processing: Server uses a thread pool to process packets without blocking the event loop.
- ✅ JSON Communication: Structured data exchange using Jackson (Java) and json (Python).
- ✅ Flow Control: Demonstrates handling of rapid packet bursts with slow processing.
.
├── src/main/java/
│ ├── Http3BidirectionalStreamServer.java # Server implementation
│ ├── Http3Client.java # Java Client implementation
│ ├── ServerMain.java # Server entry point
│ ├── ClientMain.java # Java Client entry point
│ ├── DataPacket.java # Data model for packets
│ ├── AckResponse.java # Response model for acknowledgments
│ └── QuicTest.java # QUIC availability test
├── python_client.py # Python Client implementation
├── pyproject.toml # Python configuration & dependencies (Poetry)
├── build.gradle # Gradle build configuration
└── poetry.lock # Locked Python dependencies
- Java 21 or higher.
- Python 3.10 or higher (for the Python client).
- Poetry (for Python dependency management).
- OpenSSL (to generate certificates).
The HTTP/3 server requires an SSL certificate and private key to function. Run the following command in the project root to generate self-signed certificates:
openssl req -x509 -newkey rsa:2048 -keyout server.key -out server.crt -days 365 -nodes -subj "/CN=localhost"This will create server.key and server.crt in your current directory.
This project uses Poetry for Python dependency management (similar to Gradle for Java).
-
Install Poetry (if not already installed):
pip install poetry
-
Install Dependencies:
poetry install
The server starts on port 9443 using the certificates generated in step 1.
./gradlew run./gradlew runClientpoetry run python python_client.pyThe Java client has been optimized for:
- Correct Pipeline Setup: Uses
Http3ClientConnectionHandlerandHttp3.newRequestStreamfor proper HTTP/3 frame handling. - Strict JSON Serialization: Uses Jackson annotations to ensure JSON compatibility between Java and Python components.
- Resilient Deserialization: Handles variations in JSON field names (e.g.,
isFinalvsfinal) gracefully.
The server is designed to be "slow" by introducing a random delay (500ms - 1500ms) for each packet. This highlights the bidirectional nature of the protocol where the client can keep sending packets while waiting for individual ACKs to arrive out-of-order or delayed.
- Netty Incubator HTTP/3 & QUIC: For the core protocol implementation.
- Jackson Databind: For JSON processing in Java.
- aioquic: For the Python client implementation.