public void connect() throws ConnectionException {
		while (!connected) {
			try {
				source = new Socket(server, port);
				OutputStream sourceOutputStream = source.getOutputStream();
				if (filename == null)
					filename = "/";
				if (!filename.startsWith("/"))
					filename = "/" + filename;
				String request = "GET " + filename + " HTTP/1.0\r\n" + "Host: "
						+ source.getLocalAddress() + "\r\n" + "User-Agent: "
						+ Fluid.version + "\r\n" + "Accept: */*\r\n"
						+ "Connection: close\r\n";
				if (username != null && password != null)
					request = request + "Authorization: Basic "
							+ Base64Encoder.encode(username + ":" + password)
							+ "\r\n";
				sourceOutputStream.write(request.getBytes());
				sourceOutputStream.write("\r\n\r\n".getBytes());
				sourceOutputStream.flush();
				InputStream sourceInputStream = source.getInputStream();
				setInputStream(sourceInputStream);
				// give the source a chance to send something
				try {
					Thread.sleep(1000);
				}
				catch(InterruptedException e) {
					// nah
				}
				if(sourceInputStream.available() > 0) {
					byte[] response = new byte[sourceInputStream.available()];
					sourceInputStream.read(response);
					String responseString = new String(response);
					if(responseString.indexOf(" 200 ") < 0)
						throw new IOException('\n' + responseString.trim());
				}
				connected = true;
				engine = new Thread(this, getClass().getName() + " Engine");
				engine.start();
			} 
			catch (UnknownHostException e) {
				connected = false;
				throw new ConnectionException(e);
			}
			catch (IOException e) {
				connected = false;
				Fluid.error(e);
				Fluid.log(
						"Source: Could not connect to http://" +
						server + ":" + port + filename + "(retrying in " + interval + " seconds)" 
						);
				try {
					Thread.sleep(interval * 1000);
				}
				catch(InterruptedException ie) {
					// nah
				}
			}
		}
		Fluid.log(
				"Source: Connected to http://" +
				server + ":" + port + filename
				);
	}