code: function (requestMatcher, requestHandler, times) {
              return {
                  then: function (sucess, error) {
                      try {
                          var webSocketClient = WebSocketClient(host, port, cleanedContextPath);
                          webSocketClient.requestCallback(function (request) {
                              var response = requestHandler(request);
                              response.headers = arrayUniqueConcatenate(response.headers, [
                                  {"name": "WebSocketCorrelationId", "values": request.headers["WebSocketCorrelationId"] || request.headers["websocketcorrelationid"]}
                              ]);
                              return {
                                  type: "org.mockserver.model.HttpResponse",
                                  value: JSON.stringify(response)
                              };
                          });
                          webSocketClient.clientIdCallback(function (clientId) {
                              return makeRequest(host, port, "/expectation", createExpectationWithCallback(requestMatcher, clientId, times)).then(sucess, error)
                          });
                      } catch (e) {
                          error && error(e);
                      }
                  }
              };
          }
docs: Setup an expectation by specifying a request matcher, and
  a local request handler function.  The request handler function receives each
  request (that matches the request matcher) and returns the response that will be returned for this expectation.
  
  for example:
  
  client.mockWithCallback(
  {
  path: '/somePath',
  body: 'some_request_body'
  },
  function (request) {
  var response = {
  statusCode: 200,
  body: 'some_response_body'
  };
  return response
  }
  ).then(
  function () {
  alert('expectation sent');
  },
  function (error) {
  alert('error');
  }
  );
  
  @param requestMatcher the request matcher for the expectation
  @param requestHandler the function to be called back when the request is matched
  @param times the number of times the requestMatcher should be matched