'Stop accepting connections on this port.
This will shut down my socket and call self.connectionLost().
@return: A L{Deferred} that fires when this port has stopped.'

def stopListening(self):

    self.stopReading()
    if self.disconnecting:
        return self._stoppedDeferred
    elif self.connected:
        self._stoppedDeferred = task.deferLater(self.reactor, 0, self.connectionLost)
        self.disconnecting = True
        return self._stoppedDeferred
    else:
        return defer.succeed(None)
