public void disconnect() throws IOException {
    	if(!clientSocket.isClosed() && bytesSent < contentLength)
    		write(new byte[(int)(contentLength - bytesSent)]);
    	connected = false;
    	clientSocket.close();
    }