public function authenticate() {

                // Check whether the socket is already connected
                if( !$this->connection->established ) {

			// Throw an MPDException along with the connection errors
			throw new MPDException( 'The connection to MPD has not been established', self::MPD_CONNECTION_NOT_ESTABLISHED );
                }

		// Send the connection password
                if( $this->connection->hasPassword() ) {

			// Authenticate to MPD
			if( !$this->password( $this->connection->password )) {

				// We might as well not be connected
				$this->connection->close();

				// If the password fails, then we're not going to be able to do much
				throw new MPDException( 'MPD did not like the provided password', self::MPD_BAD_PASSWORD );
			}

		} else {

			// We might as well not be connected
			$this->connection->close();

			// If we don't have a password, then we're not going to be able to do much
			throw new MPDException( 'Must supply a password to authenticate to MPD', self::MPD_NO_PASSWORD );
		}

		// Password must have been accepted
		return true;
	}