'L{ITCPTransport.write} and L{ITCPTransport.writeSequence} send bytes to
the other end of the connection.'

def test_writer(self):

    f = protocol.Factory()
    f.protocol = WriterProtocol
    f.done = 0
    f.problem = 0
    wrappedF = WiredFactory(f)
    p = reactor.listenTCP(0, wrappedF, interface='127.0.0.1')
    self.addCleanup(p.stopListening)
    n = p.getHost().port
    clientF = WriterClientFactory()
    wrappedClientF = WiredFactory(clientF)
    reactor.connectTCP('127.0.0.1', n, wrappedClientF)
    def check(ignored):
        self.assertTrue(f.done, "writer    didn't    finish,    it    probably    died")
        self.assertTrue((f.problem == 0), 'writer    indicated    an    error')
        self.assertTrue(clientF.done, "client    didn't    see    connection    dropped")
        expected = ''.join(['Hello    Cleveland!\n', 'Goodbye', '    cruel', '    world', '\n'])
        self.assertTrue((clientF.data == expected), "client    didn't    receive    all    the    data    it    expected")
    d = defer.gatherResults([wrappedF.onDisconnect, wrappedClientF.onDisconnect])
    return d.addCallback(check)
