Package controller

Class TestProtocols

java.lang.Object
controller.TestProtocols

public class TestProtocols extends Object
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 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:

      1. Adding data to HTTPS, POP, and HTTP protocols
      2. Reading data in mixed order to demonstrate independent queues
      3. Testing empty queue behavior and automatic protocol removal
      4. Attempting to read from non-existent protocols
      Throws:
      Exception - if any unexpected error occurs during testing