Split stream.go into layer1, layer2, layer3, and sasl.
// The lowest level of XMPP protocol, where TLS is applied after the// initial handshake.packagexmppimport("io""time""net")func(cl*Client)readTransport(wio.WriteCloser){deferw.Close()p:=make([]byte,1024)for{ifcl.socket==nil{cl.waitForSocket()}cl.socket.SetReadDeadline(time.Now().Add(time.Second))nr,err:=cl.socket.Read(p)ifnr==0{iferrno,ok:=err.(*net.OpError);ok{iferrno.Timeout(){continue}}Warn.Logf("read: %s",err)break}nw,err:=w.Write(p[:nr])ifnw<nr{Warn.Logf("read: %s",err)break}}}func(cl*Client)writeTransport(rio.Reader){defercl.socket.Close()p:=make([]byte,1024)for{nr,err:=r.Read(p)ifnr==0{Warn.Logf("write: %s",err)break}nw,err:=cl.socket.Write(p[:nr])ifnw<nr{Warn.Logf("write: %s",err)break}}}