Package controller
Class TestProtocols
java.lang.Object
controller.TestProtocols
Test class for demonstrating the Router functionality and protocol management system.
This class provides a comprehensive test scenario that showcases the FIFO behavior,
automatic protocol management, and error handling of the Router system.
The test simulates real-world network traffic with multiple protocols and demonstrates the complete lifecycle of protocol data management.
- Since:
- 2024
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Executes a comprehensive test of the Router system.
-
Constructor Details
-
TestProtocols
public TestProtocols()Default constructor for TestProtocols. Calls the superclass constructor.
-
-
Method Details
-
beginTest
public void beginTest()Executes a comprehensive test of the Router system. This test demonstrates:- Adding data to multiple protocols
- FIFO (First-In-First-Out) data retrieval
- Automatic protocol cleanup when queues become empty
- Error handling for non-existent protocols
- Concurrent protocol management
The test scenario includes:
- Adding data to HTTPS, POP, and HTTP protocols
- Reading data in mixed order to demonstrate independent queues
- Testing empty queue behavior and automatic protocol removal
- Attempting to read from non-existent protocols
- Throws:
Exception
- if any unexpected error occurs during testing
-