private void recordSound() {
		AudioFormat audioFormat = new AudioFormat(8000, 	/* sampleRate as a float */
													8, 		/* sampleSizeInBits */
													1, 		/* channels */
													true,	/* signed */
													true); 	/* bigEndian */
		int frameSize = audioFormat.getFrameSize();
		DataLine.Info datalineInfo = new DataLine.Info(TargetDataLine.class, audioFormat);

		// make sure we can handle this info line before continuing
		if (!AudioSystem.isLineSupported(datalineInfo)) {
			System.out.println("datalineInfo is not supported" + datalineInfo);
			this.stop();
			return;
		}

		TargetDataLine targetDataLine = null;
		try {
			targetDataLine = (TargetDataLine) AudioSystem.getLine(datalineInfo);
			int lineBufferSize = targetDataLine.getBufferSize();
			targetDataLine.open(audioFormat, lineBufferSize);
		} catch (LineUnavailableException e) {
			System.out.println("Failed to open targetDataLine");
			e.printStackTrace();
			this.stop();
		}

		// if we make it this far, the line is open and we have recorded data
		int bufferLength = (targetDataLine.getBufferSize() / 8) * frameSize;
		byte[] dataArray = new byte[bufferLength];

		targetDataLine.start();
		
		ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
		int writeIndex = 0;
		while (true == record) {
			// Keep reading till we reach the end of the targetDataLine
			int readIndex = targetDataLine.read(dataArray, 0, bufferLength);
			if (-1 == readIndex) {
				break;
			} else {
				outBuffer.write(dataArray, 0, readIndex);
				Data.setDataBuffer(outBuffer.toByteArray());
				
				// if we have a chunks worth of data, write it to the socket
				if (outBuffer.toByteArray().length >= (writeIndex + this.chunkSize)) {
					byte[] chunk = Arrays.copyOfRange(outBuffer.toByteArray(), writeIndex, (writeIndex + this.chunkSize));
					this.writeToSocket(chunk);
					writeIndex = writeIndex + this.chunkSize;
				}
			}
		}

		// clean up the targetDataLine
		targetDataLine.stop();
		targetDataLine.close();

		// line is closed, now close the outputStream and process
		// process the it so then we can write it
		try {
			outBuffer.flush();
			outBuffer.close();
		} catch (IOException e) {
			System.out.println("Failed to close the outputStream");
			e.printStackTrace();
		}
	}