   nil)
 
 (defn- connect-server
-  "Establishes a new connection to the OLA server, returning the value the @connection atom should hold for using it.
-Takes the current connection, if any, as its argument, in case cleanup is needed."
+  "Establishes a new connection to the OLA server, returning the value
+  the @connection atom should hold for using it. Takes the current
+  connection, if any, as its argument, in case cleanup is needed."
   [conn]
   (when (:socket conn)
     (disconnect-server conn)) ;; Clean up any old connection, e.g. if a read failed

                            (bit-shift-right (bit-and header version-mask) 28))))))

(defn- read-fully
  "Will fill the buffer to capacity, or throw an exception. Returns the number of bytes read."
  ^long [^InputStream input ^bytes buf]
  (loop [off 0 len (alength buf)]
    (let [in-size (.read input buf off len)]
      (cond

      (warn e "Unable to connect to olad server, is it running?"))))

(defn- build-header
  "Calculates the correct 4-byte header value for an OLA request of
  the specified length."
  [length]
  (bit-or (bit-and length size-mask) version-masked))

(defn- parse-header
  "Returns the length encoded by a header value, after validating the
  protocol version."
  [header]
  (if (= (bit-and header version-mask) version-masked)
    (bit-and header size-mask)
