|
1 | | -# Java Exercise Template |
2 | | -This template repository is used to create autograded Java exercise repositories for CBF Academy bootcamps. It includes a GitHub Classroom autograding workflow that scores student submissions on functionality and code quality by executing unit tests and submitting the code changes for review by an automated agent. |
3 | | - |
4 | | -## Usage |
5 | | - |
6 | | -1. Create a new repository for the exercise, with the following settings: |
7 | | - - Template: Select this repository |
8 | | - - Name: Use the `java-exercises-[exercise name]` naming convention, e.g. `java-exercises-spring-boot` |
9 | | - - Visibility: Public (needed for Classroom) |
10 | | -2. After initialising, navigate to the repo settings and set as a template, so it can be used for assignments |
11 | | -3. Commit README, Maven assets, starter code and unit tests to the main branch |
12 | | -4. Create a solutions branch and commit any reference solutions code to it |
13 | | -5. Modify the `MAX_TESTS` environment variable to reflect the total number of tests available |
14 | | -6. Push all changes |
15 | | - |
16 | | -## Testing |
17 | | - |
18 | | -1. Create a new Classroom assignment using the exercise repo as the starter template, with the following settings |
19 | | - - Repository visibility: Private |
20 | | - - Grant students admin access to their repository: Disabled |
21 | | - - Copy the default branch only: Enabled |
22 | | - - Supported editor: Don't use an online IDE |
23 | | - - Protected file paths: `.github/**/*`, `**/test/**/*` |
24 | | - - Enable feedback pull requests: Enabled |
25 | | -2. Accept the assignment from a test account. |
26 | | -3. Commit and push |
27 | | -4. Review the Actions output and Feedback PR comment to ensure everything operates as expected |
| 1 | +# Client-Server Architecture |
| 2 | + |
| 3 | +[][1] |
| 4 | +[][2] |
| 5 | +[][3] |
| 6 | + |
| 7 | +The goal of these programming exercises is to practise: |
| 8 | +- communication with a remote server |
| 9 | +- using the `java.net.*` package capabilities |
| 10 | + |
| 11 | +For this assignment, we've provided the starter project above. |
| 12 | + |
| 13 | +## :earth_africa: Using URLs |
| 14 | + |
| 15 | +Modify [App.java](src/main/java/com/cbfacademy/App.java) to connect to the main CBF website at https://codingblackfemales.com, then read its content line by line and print each line to the screen. |
| 16 | + |
| 17 | +You will need to use `HttpURLConnection`, `BufferedReader` and `InputStreamReader` classes. |
| 18 | + |
| 19 | +Whenever possible, use the try-with-resources construct we saw earlier in the course, and ensure to release all resources. |
| 20 | + |
| 21 | +## :phone: Client & Server |
| 22 | + |
| 23 | +Create a simple program with two classes: |
| 24 | +- a `ExerciseServer` class which uses a `ServerSocket` to listen for connections on `localhost:4040`, then prints message it receives on the screen. |
| 25 | +- a `ExerciseClient` class which requests a connection to server, sends a simple text message to the server. |
| 26 | + |
| 27 | +Ensure to release all resources at the end of your program. |
| 28 | + |
| 29 | +[1]: https://docs.oracle.com/javase/21/docs/api/index.html |
| 30 | +[2]: https://junit.org/junit5/ |
| 31 | +[3]: https://maven.apache.org/ |
0 commit comments