@Test
public void testNotExpected() throws Exception {

    Session session = new Session(communications, options, new HandshakeHandler(), new RequestHandler(screen));
    session.setExpecting(PACKETS.HANDSHAKE_CHALLENGE);
    HandshakePacket handshakePacket = new HandshakePacket();
    handshakePacket.getFlags().setHandshakeRequest(true).setRegistered(true);
    PublicKey key = new PublicKey();
    key.setFingerPrint(new byte[32]);
    handshakePacket.setKey(key);
    PacketBuffer packetBuffer = new PacketBuffer();
    handler.initPacketBuffer(packetBuffer);
    packetBuffer.write(handshakePacket.getParser().serialize());
    assertEquals(CONNECTION_PHASE.FAILED, handler.handlePacket(packetBuffer, session));
}