void read()
	{

		lastDataTime = System.currentTimeMillis();



		byte[] readBuffer = inputBuffer.buffer;
		int bytesAvailable = 0;

		try {
			bytesAvailable = inputStream.read(readBuffer, inputBuffer.length, readBuffer.length-inputBuffer.length);
			inputBuffer.length += bytesAvailable;
		} catch (IOException e) {
			e.printStackTrace();
		}

		if(bytesAvailable <= 0)
			return;

		if(justConnected)
		{
			try
			{
				String s = ByteArray.readUTF(inputBuffer, 0, inputBuffer.length);

				log.debug("str req: " + s);
				if(s.equals(POLICY_REQUEST))
				{
					sendString(POLICY);
					inputBuffer.position = 0;
					return;
				}

			} catch (IOException e)
			{
				log.debug("try to read cross domain request");
			}
		}


		//log.debug("read from socket: " + bytesAvailable + " bytes");

		bufferLength += bytesAvailable;

		processBuffer();
	}