public void run() {
		try {
			if (isListener) {
				connection = listener.accept();
				writeBuffer = new QueueBuffer<String>(connection.getOutputStream());
				readBuffer = new BufferedReader(new InputStreamReader(connection.getInputStream()));
				
				handler.setState(State.CONNECTED);
			}

			while (true) {
				String in = readBuffer.readLine();
				if (in == null) break;
				handler.fireRawTextEvent(in);

				Thread.yield();
			}		
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				writeBuffer.close();
				readBuffer.close();
				connection.close();
				listener.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}