         return server
     }
 
-    /// Listens for connections on a socket
-    ///
-    /// - Parameter port: port number for new connections (eg. 8080)
-    /// - Parameter errorHandler: optional callback for error handling
+    /**
+     Listen for connections on a socket.
+     
+     ### Usage Example: ###
+     ````swift
+     try server.listen(on: 8080, errorHandler: errorHandler)
+     ````
+     - Parameter port: port number for new connections (eg. 8080)
+     - Parameter errorHandler: optional callback for error handling
+     */
     @available(*, deprecated, message: "use 'listen(on:) throws' with 'server.failed(callback:)' instead")
     public func listen(port: Int, errorHandler: ((Swift.Error) -> Void)? = nil) {
         do {

        _ = HTTPServer.oneTime
    }

    /// Listens for connections on a socket
    ///
    /// - Parameter on: port number for new connections (eg. 8080)
    public func listen(on port: Int) throws {
        self.port = port
        do {


// MARK: HTTPServer

/**
An HTTP server that listens for connections on a socket.

### Usage Example: ###
````swift
 //Create a server that listens for connections on a specified socket.
 let server = try HTTPServer.listen(on: 0, delegate: delegate)
 ...
 //Stop the server.
 server.stop()
````
*/
public class HTTPServer: Server {

    public typealias ServerType = HTTPServer

    /**
     HTTP `ServerDelegate`.
     
     ### Usage Example: ###
     ````swift
     httpServer.delegate = self
     ````
     */
    public var delegate: ServerDelegate?

    /**
     Port number for listening for new connections.
     
     ### Usage Example: ###
     ````swift
     httpServer.port = 8080
     ````
     */
    public private(set) var port: Int?

    /**
     A server state
     
     ### Usage Example: ###
     ````swift
     if(httpSever.state == .unknown) {
        httpServer.stop()
     }
     ````
     */
    public private(set) var state: ServerState = .unknown

    /// TCP socket used for listening for new connections
    private var listenSocket: Socket?

    /**
     Whether or not this server allows port reuse (default: disallowed).
     
     ### Usage Example: ###
     ````swift
     httpServer.allowPortReuse = true
     ````
     */
    public var allowPortReuse: Bool = false

    /// Maximum number of pending connections
    private let maxPendingConnections = 100

    /**
     Controls the maximum number of requests per Keep-Alive connection.
     
     ### Usage Example: ###
     ````swift
     httpServer.keepAliveState = .unlimited
     ````
     */
    public var keepAliveState: KeepAliveState = .unlimited
    
    /// Incoming socket handler
    private var socketManager: IncomingSocketManager?

    /**
     SSL cert configuration for handling client requests.
     
     ### Usage Example: ###
     ````swift
     httpServer.sslConfig = sslConfiguration
     ````
     */
    public var sslConfig: SSLService.Configuration?

    fileprivate let lifecycleListener = ServerLifecycleListener()
