903
903
SmartTCPServer.__init__(self,
904
904
transport.get_transport(urlutils.local_path_to_url('/')))
906
def get_backing_transport(self, backing_transport_server):
907
"""Get a backing transport from a server we are decorating."""
908
return transport.get_transport(backing_transport_server.get_url())
910
def setUp(self, backing_transport_server=None):
907
911
"""Set up server for testing"""
912
from bzrlib.transport.chroot import TestingChrootServer
913
if backing_transport_server is None:
914
from bzrlib.transport.local import LocalURLServer
915
backing_transport_server = LocalURLServer()
916
self.chroot_server = TestingChrootServer()
917
self.chroot_server.setUp(backing_transport_server)
918
self.backing_transport = transport.get_transport(
919
self.chroot_server.get_url())
908
920
self.start_background_thread()
910
922
def tearDown(self):
911
923
self.stop_background_thread()
914
"""Return the url of the server"""
915
host, port = self._server_socket.getsockname()
916
return "bzr://%s:%d%s" % (host, port, urlutils.escape(self._homedir))
918
925
def get_bogus_url(self):
919
926
"""Return a URL which will fail to connect"""
920
927
return 'bzr://127.0.0.1:1/'