1
Fetch the files below from our GitHub repository
Save these files to your project folder:
2
Generate the certificates
Run the following command to generate the certificates.
3
Start the Java server
This will run the Java server and map port 5001 on your host to 5001 in the container.
4
Extract the certificate for curl
You need to place the server certificate (https.crt) on your host so you can communicate with curl.Copy it from the container Docker volume to your host (The container name in our example is
jdk-jre-tls-test-app-1
):5
Test with curl
Now you can send curl requests to your Java server.
-
Send a curl command to the default endpoint to get a text response:
You should get the following response:
-
Send a curl command to the JSON endpoint:
You should get the following response: