switch (opcode) {
case CancelMessage.MESSAGE_ID:
message = new CancelMessage();
break;
case BitFieldMessage.MESSAGE_ID:
message = new BitFieldMessage();
break;
case ChokeMessage.MESSAGE_ID:
message = new ChokeMessage();
break;
case HaveMessage.MESSAGE_ID: