class StatusMessageHandler extends PeerRequiredLocalMessageHandler<StatusMessage, StatusMessage> {

  @Override
  public void onIncomingMessage(
      final Eth2Peer peer,
      final StatusMessage message,
      final ResponseCallback<StatusMessage> callback) {
    LOG.trace("Peer {} sent status {}", peer.getId(), message);
    if (!peer.wantToMakeRequest()) {
      return;
    }
    final PeerStatus status = PeerStatus.fromStatusMessage(message);
    peer.updateStatus(status);

    final Optional<StatusMessage> localStatus = statusMessageFactory.createStatusMessage();
    if (localStatus.isPresent()) {
      callback.respondAndCompleteSuccessfully(localStatus.get());
    } else {
      LOG.warn(
          "Node is not ready to receive p2p traffic. Responding to incoming status message with an error.");
      callback.completeWithErrorResponse(NODE_NOT_READY);
    }
  }

  public  StatusMessageHandler(final StatusMessageFactory statusMessageFactory);

}