@SuppressWarnings("incomplete-switch")
    /* package */void processInputMessage (BitTorrentMessage msg) {
        assert msg != null;

        switch (msg.getMessageType()) {
            case HANDSHAKE_START:
                HandShakeStart hss = (HandShakeStart) msg;
                remoteFlags.or(hss.getFlags());
                remoteHash = hss.getHash();
                remoteProtocol = hss.getProtocolName();
                remoteHandShakeStarted = true;
            break;

            case HANDSHAKE_END:
                HandShakeEnd hse = (HandShakeEnd) msg;
                remotePeerId = hse.getPeerId();
                remoteHandShakeFinished = true;
            break;

            case CHOKE:
                remoteChoking = true;
            break;

            case UNCHOKE:
                remoteChoking = false;
            break;

            case INTERESTED:
                remoteInterested = true;
            break;

            case UNINTERESTED:
                remoteInterested = false;
            break;

            case HAVE:
                remoteClaimedPieces.set(((HaveMessage) msg).getPieceIndex());
            break;

            case BITFIELD:
                remoteClaimedPieces.or(((BitFieldMessage) msg).getBitField());
            break;
        }
    }