'Switch this BinaryBoxProtocol\'s transport to a new protocol.  You need
to do this \'simultaneously\' on both ends of a connection; the easiest
way to do this is to use a subclass of ProtocolSwitchCommand.
@param newProto: the new protocol instance to switch to.
@param clientFactory: the ClientFactory to send the
L{twisted.internet.protocol.ClientFactory.clientConnectionLost}
notification to.'

def _switchTo(self, newProto, clientFactory=None):

    newProtoData = self.recvd
    self.recvd = ''
    self.innerProtocol = newProto
    self.innerProtocolClientFactory = clientFactory
    newProto.makeConnection(self.transport)
    if newProtoData:
        newProto.dataReceived(newProtoData)
