Your pipe appears legal, but the tee is not- needs to be a wye. Glue short pieces in each end. Measure this new length and cut it into the pipe.
Roll the wye up above the center line of the drain pipe.
Use shielded couplings to make the connections.
To do this, slide the bands on the cut pipe- both ends. Then put on the rubber piece and roll the end that faces the fitting back on to of itself. Drop in the fitting with stubs and unroll the rubber. Slide the bands into position and tighten to 60 inch pounds