code: @Override
  	public void close() throws Exception {
  		try {
  			if (outputStream != null) {
  				outputStream.flush();
  				outputStream.close();
  			}
  
  			// first regular attempt to cleanly close. Failing that will escalate
  			if (client != null) {
  				client.close();
  			}
  		}
  		catch (Exception e) {
  			throw new IOException("Error while closing connection that streams data back to client at "
  					+ hostIp.toString() + ":" + port, e);
  		}
  		finally {
  			// if we failed prior to closing the client, close it
  			if (client != null) {
  				try {
  					client.close();
  				}
  				catch (Throwable t) {
  					// best effort to close, we do not care about an exception here any more
  				}
  			}
  		}
  	}
docs: Closes the connection with the Socket server.