code: private static List<ResponsePacket> readResponses(Socket socket) {
  		List<ResponsePacket> responses = new Vector<ResponsePacket>();
  		int previousTimeout = 0;
  		try {
  			/* Set socket timeout to avoid getting stuck on read() */
  			try {
  				previousTimeout = socket.getSoTimeout();
  				socket.setSoTimeout(TIMEOUT);
  			} catch (Exception e) {
  			}
  			InputStream input = socket.getInputStream();
  			while (true) {
  				ResponsePacket packet = readResponsePacketData(input);
  				if (packet != null) responses.add(packet);
  				else break;
  			}
  
  		} catch (Exception e) {
  			/* Ignore exception, as we are expecting timeout exceptions because Apple might not reply anything */
  			//System.out.println(e);
  		}
  		/* Reset socket timeout, just in case */
  		try {
  			socket.setSoTimeout(previousTimeout);
  		} catch (Exception e) {
  		}
  		//System.out.println("Received "+responses.size()+" response packets");
  		return responses;
  	}
docs: Read raw response packets from the provided socket.
  
  Note: this method automatically sets the socket's timeout
  to TIMEOUT, so not to block the socket's input stream.
  
  @param socket
  @return