@Override
	public void receiveProtocol(AsynchronousConnection asynchronousConnection) throws IOException {
		while (asynchronousConnection.getReader().getBuffer().hasRemaining()) {
			if (getOpcode() == -1) {
				setOpcode(asynchronousConnection.getReader().getBuffer().get() - asynchronousConnection.getSecureRead().getNextValue() & 0xFF);
				setLength(Constants.PACKET_SIZES[getOpcode()]);
			}
			if (getLength() == -1) {
				if (!asynchronousConnection.getReader().getBuffer().hasRemaining()) {
					asynchronousConnection.getReader().getBuffer().clear();
					return;
				}
				setLength(asynchronousConnection.getReader().getBuffer().get() & 0xFF);
			}
			if (asynchronousConnection.getReader().getBuffer().remaining() < getLength()) {
				asynchronousConnection.getReader().getBuffer().compact();
				return;
			}
			byte[] payloadSize = new byte[getLength()];
			asynchronousConnection.getReader().getBuffer().get(payloadSize);
			ByteBuffer packetPayload = ByteBuffer.allocate(getLength());
			packetPayload.put(payloadSize);
			packetPayload.flip();
			IncomingPacket packetRead = new IncomingPacket(packetPayload, getOpcode(), getLength());
			IncomingPacketRegistration.dispatchToListener(packetRead, asynchronousConnection.getPlayer());
			setOpcode(-1);
			setLength(-1);
		}
	}