code: public String queryLivestatus( String nagiosQuery ) throws UnknownHostException, IOException {
  
  		Socket liveStatusSocket = null;
  		try {
  			this.logger.fine( "About to open a connection through Live Status..." );
  			liveStatusSocket = new Socket( this.host, this.port );
  			this.logger.fine( "A connection was established through Live Status." );
  
  			Writer osw = new OutputStreamWriter( liveStatusSocket.getOutputStream(), StandardCharsets.UTF_8 );
  			PrintWriter printer = new PrintWriter( osw, false );
  
  			printer.print( nagiosQuery );
  			printer.flush();
  			liveStatusSocket.shutdownOutput();
  
  			ByteArrayOutputStream os = new ByteArrayOutputStream();
  			Utils.copyStreamSafely( liveStatusSocket.getInputStream(), os );
  
  			String result = os.toString( "UTF-8" );
  			result = format( nagiosQuery, result );
  			return result;
  
  		} finally {
  			if( liveStatusSocket != null )
  				liveStatusSocket.close();
  
  			this.logger.fine( "The Live Status connection was closed." );
  		}
  	}
docs: Queries a live status server.
  @param nagiosQuery the query to pass through a socket (not null)
  @return the response
  @throws UnknownHostException
  @throws IOException