code: public void disconnect() {
          if (readyState == ReadyState.OPEN) {
              // readyState should be set to ReadyState.CLOSED ONLY AFTER the
              // the WebSocket has been successfully closed in
              // socketClosedHandler().
              this.closeConnection(0, "", 0, 0, null, null);
          } else if (readyState == ReadyState.CONNECTING) {
              socketClosedHandler();
          }
      }
docs: Disconnects from Amqp Server.