@Test
  public void ingressEgressMacsAsExpected() {
    // Initiator end of the handshake.
    final ECIESHandshaker initiator = new ECIESHandshaker();
    initiator.prepareInitiator(
        NodeKeyUtils.createFrom(Input.initiatorKeyPair), Input.responderKeyPair.getPublicKey());
    initiator.firstMessage();
    initiator.setInitiatorMsgEnc(Bytes.wrap(Messages.initiatorMsgEnc));
    initiator.setEphKeyPair(Input.initiatorEphKeyPair);
    initiator.setInitiatorNonce(Input.initiatorNonce);

    // Responder end of the handshake.
    final ECIESHandshaker responder = new ECIESHandshaker();
    responder.prepareResponder(NodeKeyUtils.createFrom(Input.responderKeyPair));
    responder.setEphKeyPair(Input.responderEphKeyPair);
    responder.setResponderNonce(Input.responderNonce);

    // Exchange encrypted test messages.
    responder.handleMessage(Unpooled.wrappedBuffer(Messages.initiatorMsgEnc));
    initiator.handleMessage(Unpooled.wrappedBuffer(Messages.responderMsgEnc));

    // Override the message sent from the responder with the test vector, and regenerate the
    // secrets.
    responder.setResponderMsgEnc(Bytes.wrap(Messages.responderMsgEnc));
    responder.computeSecrets();

    // Assert that the initiator's secrets match the expected values.
    assertThat(initiator.secrets().getAesSecret()).isEqualTo(Expectations.aesSecret);
    assertThat(initiator.secrets().getMacSecret()).isEqualTo(Expectations.macSecret);
    assertThat(initiator.secrets().getToken()).isEqualTo(Expectations.token);
    assertThat(initiator.secrets().getIngressMac()).isEqualTo(Expectations.initialIngressMac);
    assertThat(initiator.secrets().getEgressMac()).isEqualTo(Expectations.initialEgressMac);

    // Assert that the responder's secrets match the expected values, where the ingress and egress
    // are reversed.
    assertThat(responder.secrets().getAesSecret()).isEqualTo(Expectations.aesSecret);
    assertThat(responder.secrets().getMacSecret()).isEqualTo(Expectations.macSecret);
    assertThat(responder.secrets().getToken()).isEqualTo(Expectations.token);
    assertThat(responder.secrets().getIngressMac()).isEqualTo(Expectations.initialEgressMac);
    assertThat(responder.secrets().getEgressMac()).isEqualTo(Expectations.initialIngressMac);
  }
Test vectors taken from https://gist.github.com/fjl/3a78780d17c755d22df2
ethereum/p2p/src/test/java/org/hyperledger/besu/ethereum/p2p/rlpx/handshake/ecies/ECIESHandshakeTest.java