You can connect to multiple nREPL servers using M-x
cider-connect) multiple times. To close the current nREPL connection, use
C-c C-q (
cider-quit). You can close all connections with
C-u C-c C-q.
CIDER maintains a list of nREPL connections and a single 'default' connection. When you execute CIDER commands in a Clojure editing buffer such as to compile a namespace, these commands are executed against a specific connection.
You can display the current nREPL connection using C-c M-d and rotate the default connection using C-c M-r.
Switch to connection buffer
The REPL buffers double as connection buffers.
To switch to the relevant REPL buffer based on the Clojure namespace in the current Clojure buffer, use: C-c C-z. You can then use the same key combination to switch back to the Clojure buffer you came from.
The single prefix C-u C-c C-z, will switch you to the relevant REPL buffer and set the namespace in that buffer based on namespace in the current Clojure buffer.