Module: models/abstractServer

Defines the template for the protocols, abstracting logging, error-handling,
and proper close behavior for consistency. While it's useful to not have to
duplicate these responsibilities per protocol implementation, I haven't been
crazy about this abstraction (it requires a lot of ping-ponging between this
module and the actual implementation to understand a protocol) and may tweak it.

Source:

Methods

create(options) → {Object}

Creates the protocol-specific server

Parameters:
Name Type Description
options Object

The startup options

Source:
Returns:
  • The interface for all protocols
Type
Object

(inner) implement(implementation, recordRequests, debug, baseLogger) → {Object}

Creates the protocol implementation

Parameters:
Name Type Description
implementation Object

The protocol implementation

Properties
Name Type Description
protocolName string

The name of the protocol (prefer lower-case letters)

createServer function

The function to create the server and listen on a socket

Request Object

The request type for the protocol

recordRequests boolean

Whether or not we should record requests (the --mock command line flag)

debug boolean
  • Whether or not we should record stub matches (the --debug command line flag)
baseLogger Object

The logger

Source:
Returns:
Type
Object