public void parse(Parcel parcel){
	
		//The packet must have at least enough bytes to contain 
		//the header section.
		if(parcel.capacity() < HEADER_LENGTH){
			throw new PacketException("Malformed or missing packet header.");
		}
		
		//This should only be done at the top of the parsing hierarchy. 
		parcel.rewind();
		
		parcel.getByteArray(magic);
		
		if(!magicCheck()){
			throw new PacketException("Byte stream has different magic value.");
		}
		
		version = parcel.getByte();
		type = PacketType.parse(parcel.getByte());
		peer = new Peer(parcel);
		
		if(parcel.capacity() > HEADER_LENGTH){
			
			byte[] contentBytes = new byte[parcel.capacity() - HEADER_LENGTH];
			parcel.getByteArray(contentBytes);
			contents = new Parcel(contentBytes);
			contents.rewind();
			
		}
		
	}