A Java multi-module project demonstrating TCP client-server communication using Java NIO channels and modern Java features.
The project consists of three Maven modules:
- client - TCP client module
- server - TCP server module
parent(root) - Parent module containing common dependencies and build configuration
- Modular Java application (Java Platform Module System)
- Custom runtime images using jlink
- Multi-module Maven project structure
- Java 21 features including virtual threads
- Non-blocking I/O using NIO channels
./mvnw clean packageThe project uses jlink to create optimized, minimal runtime images:
./mvnw clean package -P jlink -pl client,serverWe don't need to include the parent module in the build as it doesn't contain any application code and it doesn't support the jlink profile.
This creates custom runtime images for both client and server modules containing:
- Custom JRE with only required modules
- Application code and dependencies
- Platform-specific launchers
The runtime images can be found in:
client/target/maven-jlink/classifiers/runtime-image/server/target/maven-jlink/classifiers/runtime-image/
fr.univtln.bruno.samples.network.client- Client modulefr.univtln.bruno.samples.network.server- Server module
# Start server
./mvnw -pl server exec:java
# Start client
./mvnw -pl client exec:java# Start server
./server/target/maven-jlink/classifiers/runtime-image/bin/app
# Start client
./client/target/maven-jlink/classifiers/runtime-image/bin/appThe project includes Dockerfiles for both modules and a compose.yml for easy deployment:
docker compose up --build- JUnit 5 - Testing
- SLF4J/Logback - Logging
- Lombok - Boilerplate reduction
- Maven JLink Plugin - Custom runtime image creation
Apache License 2.0