protected void dispatch(SOSPFPacket inputPacket, SelectionKey key) {
    if (inputPacket == null) {
      System.out.println("WARNING: read null message in dispatch");
      selector.wakeup();
      return;
    }
    switch (inputPacket.sospfType) {
      case 1:
        processHello(inputPacket, key);
        break;
      case 2:
        processDD(inputPacket, key);
        break;
      case 3:
        processLSAReq(inputPacket, key);
        break;
      case 4:
        processLSAUpdate(inputPacket, key);
        break;
      case 5:
        processLSAAck(inputPacket, key);
      default:
        System.out.println("Unknown message " + inputPacket.sospfType + " from " + inputPacket.srcIP);
        break;
    }
  }