33[ ![ CI] ( https://github.com/krotname/JavaNetworkChat/actions/workflows/ci.yml/badge.svg )] ( https://github.com/krotname/JavaNetworkChat/actions/workflows/ci.yml )
44[ ![ CodeQL] ( https://github.com/krotname/JavaNetworkChat/actions/workflows/codeql.yml/badge.svg )] ( https://github.com/krotname/JavaNetworkChat/actions/workflows/codeql.yml )
55[ ![ OpenSSF Scorecard] ( https://api.securityscorecards.dev/projects/github.com/krotname/JavaNetworkChat/badge )] ( https://securityscorecards.dev/viewer/?uri=github.com/krotname/JavaNetworkChat )
6- [ ![ coverage] ( https://img.shields.io/badge/coverage-70%2B-green )] ( https://github.com/krotname/JavaNetworkChat/actions/workflows/ci.yml )
6+ [ ![ coverage summary ] ( https://img.shields.io/badge/coverage-CI%20summary-blue )] ( https://github.com/krotname/JavaNetworkChat/actions/workflows/ci.yml )
77[ ![ Java] ( https://img.shields.io/badge/Java-21-007396 )] ( https://adoptium.net/ )
88[ ![ License] ( https://img.shields.io/badge/license-GPL--3.0-blue )] ( LICENSE )
99
@@ -17,6 +17,8 @@ Network Chat is a Java 21 chat application over TCP sockets with:
1717- a Swing GUI client using MVC style structure.
1818- a production-like project layout with Gradle, tests, and CI.
1919
20+ ![ Swing GUI client] ( docs/images/gui-client.svg )
21+
2022## Run locally
2123
2224### Prerequisites
@@ -34,12 +36,27 @@ Network Chat is a Java 21 chat application over TCP sockets with:
3436
3537Server and clients can also be run directly with Java by building jars from Gradle.
3638
39+ The default server port is ` 1500 ` . Programmatic server startup can use ` ChatServerConfig ` to set the
40+ port, maximum client count, handshake timeout, and post-handshake read timeout.
41+
42+ ## Architecture and protocol
43+
44+ The compact architecture contract is documented in [ docs/architecture.md] ( docs/architecture.md ) .
45+
46+ - ` ChatServer ` accepts TCP connections and handles clients in a bounded executor.
47+ - ` ChatConnection ` reads and writes one-line UTF-8 JSON frames.
48+ - ` ChatProtocol ` serializes ` ChatMessage ` .
49+ - For ` TEXT ` messages, ` data ` contains only raw text and ` sender ` contains the author.
50+ - Console and Swing clients format display text such as ` alice: hello ` .
51+ - The bot client reads date/time commands from ` data ` and uses the author from ` sender ` .
52+
3753## Project structure
3854
3955- ` src/main/java ` — core application classes.
4056- ` src/test/java ` — unit tests.
4157- ` src/integrationTest/java ` — protocol and network integration tests.
4258- ` src/uiTest/java ` — Swing smoke tests.
59+ - ` docs ` — architecture notes and visual assets.
4360- ` .github/workflows ` — CI, CodeQL and Scorecard workflows.
4461
4562## Testing
@@ -51,12 +68,14 @@ Server and clients can also be run directly with Java by building jars from Grad
5168- ` ./gradlew jacocoTestCoverageVerification `
5269- ` ./gradlew jacocoAllReport ` (CI artifact source)
5370
54- Coverage thresholds are enforced in Gradle and CI.
71+ Coverage thresholds are enforced in Gradle and CI. The HTML JaCoCo report is uploaded as a CI
72+ artifact, and line/branch coverage is published to the GitHub Actions Summary for the Linux job.
5573
5674### Test strategy
5775
58- - ** Unit tests** (` src/test/java ` ) check protocol and UI model invariants.
59- - ** Integration tests** (` src/integrationTest/java ` ) exercise full server/client socket flow with multiple peers.
76+ - ** Unit tests** (` src/test/java ` ) check protocol, bot command handling, and UI model invariants.
77+ - ** Integration tests** (` src/integrationTest/java ` ) exercise full server/client socket flow, handshake
78+ failures, resource limits, timeouts, and multiple peers.
6079- ** UI smoke tests** (` src/uiTest/java ` ) verify Swing state rendering.
6180- ** Future hardening tests** : contract validation and error-handling matrix can be added in the same
6281 structure.
@@ -68,9 +87,9 @@ The repository runs:
6887- ` checkstyle ` for style and API cleanliness,
6988- ` spotless ` for deterministic formatting,
7089- ` spotbugs ` for bug-pattern analysis,
71- - ` jaCoCo ` line/branch coverage gate on core network/protocol layers (` 70%/55 %` ),
90+ - ` jaCoCo ` line/branch coverage gate on core network/protocol layers (` 80%/65 %` ),
7291- GitHub Actions pipeline on Linux + Windows,
73- - dependency and workflow update signals via Dependabot,
92+ - grouped dependency and workflow update signals via Dependabot,
7493- CodeQL and OpenSSF Scorecard security scans.
7594
7695The quality surface is intentionally structured for a public review: clean ` main ` surface, automated checks,
@@ -98,3 +117,15 @@ This repository is organized to be review-friendly:
98117- Security checks via CodeQL and OpenSSF Scorecard.
99118- Dependency and workflow automation via Dependabot.
100119- Explicit contributor and security docs.
120+
121+ ## Troubleshooting
122+
123+ - ` Address already in use ` : run the server on another port, for example ` ./gradlew runServer --args="--port 1600" ` .
124+ - GUI does not render in CI: UI smoke tests skip automatically in headless environments.
125+ - Client disconnects immediately: check username uniqueness and nickname length (` 3..64 ` , letters, digits, ` _ ` , ` - ` ).
126+ - Client receives ` Server is busy ` : the configured ` ChatServerConfig.maxClients ` limit has been reached.
127+
128+ ## Roadmap
129+
130+ - v1.1.x: stabilize protocol/server lifecycle, expand negative tests, and improve documentation.
131+ - Later: rooms, message history, TLS, and persistent accounts as separate product-focused phases.
0 commit comments