private void processBuffer()// throws EOFException
	{
		if(bufferLength < HEADER_SIZE)
			return;

		justConnected = false;
		Boolean isPacketReceived = bytesNeeded <= bufferLength;

		if (!isPacketReceived)
		{
			//log.debug("packet is not received yet " + bufferLength+", " + bytesNeeded);
			return;
		}


		inputBuffer.position = 0;
		bytesNeeded = inputBuffer.readInt();

		isPacketReceived = bytesNeeded <= bufferLength;

		if (!isPacketReceived)
		{
			//log.debug("packet is not received yet " + bufferLength+", " + bytesNeeded);
			return;
		}

		int type = inputBuffer.readInt();

		BytePacket reader = dataReader.getReader(type);

		if(reader != null)
		{
			reader.source = inputBuffer;
			inputBuffer.position = 0;

			reader.read();

			inputBuffer.cut(bytesNeeded);
			bufferLength -= bytesNeeded;
			bytesNeeded = 0;

			eventRouter.routData(reader, this);
		}

	}