@Override
	public void run() {
		Socket socket;
		while (!Thread.currentThread().isInterrupted()) {		
			try {

				socket = this.serverSocket.accept();
				InputStream in = socket.getInputStream();
				ByteArrayOutputStream baos = new ByteArrayOutputStream();

				byte[] buf = new byte[1024];
				while(true) {
				  int n = in.read(buf);
				  if( n < 0 ) break;
				  baos.write(buf,0,n);
				}

				byte trimmedBytes[] = baos.toByteArray();
				Packet p = Packet.deserialize(trimmedBytes);
				p.setSenderIP(socket.getInetAddress().getHostAddress());
				this.packetQueue.add(p);
				socket.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}