'Stop accepting connections on this port.
This will shut down the socket and call self.connectionLost().  It
returns a deferred which will fire successfully when the port is
actually closed, or with a failure if an error occurs shutting down.'

def loseConnection(self, connDone=failure.Failure(main.CONNECTION_DONE)):

    self.disconnecting = True
    self.stopReading()
    if self.connected:
        self.deferred = deferLater(self.reactor, 0, self.connectionLost, connDone)
        return self.deferred
