JaTyC is a powerful Java source code analysis tool designed to verify adherence to typestates in your Java programs.
This repository contains a specialized application of JaTyC for verifying Java source code that follows a specific protocol involving the interaction between FileClient and FileServer classes. The protocol defines the states, methods, and transitions that can occur during the communication process.
The protocol followed by the client (FileClient
) and the server (FileServer
) is as follows:
- The client initiates a request by sending the string
"REQUEST\n"
. - The client sends the name of the file followed by
"\n"
. - If the file exists, the server responds by sending each byte of the file back to the client.
- If the file does not exist or the end of the file is reached, the server sends the
0
byte. - After receiving the
0
byte, the client can initiate a new request by repeating steps 1 and 2 or send the string"CLOSE\n"
to conclude the protocol.
Additionally, we also show an extension of the protocol using with FileClient2
, which extends FileClient
class and allows reading each file it line by line with a new method readLine
instead of the original readByte
.
-
Run JaTyC: Execute the provided .sh file for JaTyC. If no output is displayed, it indicates that no errors were found during the verification process.
-
Start FileServer and FileClient classes in order.
-
After the client completes its interaction, it will gracefully terminate. You can see the results of the file transmission through the
FileClient
execution console.
This project utilizes the Java Typestate Checker (JaTyC) library. For more information about JaTyC and the specific protocol verification, please refer to the JaTyC GitHub repository.