code: static
  	private String resolve(String structure, String representation) throws IOException {
  		String host = "cactus.nci.nih.gov";
  		String path = "/chemical/structure/" + structure + "/" + representation;
  
  		RequestConfig config = RequestConfig.custom()
  				.setConnectTimeout(10*1000)
  				.setSocketTimeout(2*1000).build();
  		CloseableHttpClient client = HttpClients.custom()
  				.setDefaultRequestConfig(config).build();
  
  		try {
  			URI uri = new URI("http", host, path, null);
  			HttpGet request = new HttpGet(uri);
  
  			HttpResponse response = client.execute(request);
  
  			StatusLine status = response.getStatusLine();
  
  			switch(status.getStatusCode()){
  				case HttpStatus.SC_OK:
  					break;
  				case HttpStatus.SC_NOT_FOUND:
  					throw new FileNotFoundException(structure);
  				default:
  					throw new IOException(status.getReasonPhrase());
  			}
  
  			ByteArrayOutputStream os = new ByteArrayOutputStream(10 * 1024);
  
  			try {
  				HttpEntity responseBody = response.getEntity();
  
  				try {
  					responseBody.writeTo(os);
  				} finally {
  					os.flush();
  				}
  
  				String encoding = EntityUtils.getContentCharSet(responseBody);
  				if(encoding == null){
  					encoding = "UTF-8";
  				}
  
  				return os.toString(encoding);
  			} finally {
  				os.close();
  			}
  		} catch(URISyntaxException use){
  			throw new IOException(use);
  		} finally {
  			client.close();
  		}
  	}
docs: /*
  @throws FileNotFoundException If the structure is not found
  @throws IOException If an I/O exception occurs