void ProtocolConnection::internOnFrameReceived(ProtocolParser::ProtocolParserStatus status, Frame *frame) {
	onFrameReceived(status, frame);
	receiveData();
}
    TEST(test_TestWithCorrectTransportAdapter, CorrectTransportAdapterBehavior)
    {
        Logger logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("TransportManagerTest"));

        LOG4CPLUS_INFO_EXT(logger, "*************************** Starting test *****************************");
        // All expectations must be sequenced
        //InSequence dummy;

        // Creating transport manager
        TestTransportManager *pTm = new TestTransportManager();

        // Preparing transport manage client
        MockTransportManagerClient tmClient(*pTm);

        // Expected device list
        SDeviceInfo deviceInfo;
        deviceInfo.mDeviceHandle = Data::DeviceHandle;
        deviceInfo.mUniqueDeviceId = Data::UniqueDeviceId;
        deviceInfo.mUserFriendlyName = Data::UserFriendlyName;
        tDeviceList deviceList;
        deviceList.push_back(deviceInfo);

        EXPECT_CALL(tmClient, onDeviceListUpdated(ContainerEq(deviceList)))
            .Times(1)
            .WillOnce(Invoke(&tmClient, &MockTransportManagerClient::doDeviceListUpdated))
        ;

        EXPECT_CALL(tmClient, onApplicationConnected(deviceInfo, Data::ConnectionHandle))
            .Times(1)
        ;

        EXPECT_CALL(tmClient, onFrameReceived(Data::ConnectionHandle, _, 212))
            .Times(1)
            .WillOnce(Invoke(&tmClient, &MockTransportManagerClient::doFrameReceived))
        ;

        EXPECT_CALL(tmClient, onFrameSendCompleted(Data::ConnectionHandle, Data::UserData, SendStatusOK))
            .Times(1)
            .WillOnce(Invoke(&tmClient, &MockTransportManagerClient::doFrameSendCompleted))
        ;

        EXPECT_CALL(tmClient, onApplicationDisconnected(deviceInfo, Data::ConnectionHandle))
            .Times(1)
        ;



        // Running test

        pTm->addDataListener(&tmClient);
        pTm->addDeviceListener(&tmClient); 

        LOG4CPLUS_INFO_EXT(logger, "*************************** Calling RUN *****************************");
        pTm->run();

        sleep(1);

        LOG4CPLUS_INFO_EXT(logger, "*************************** Calling SCAN FOR DEVICES *****************************");
        pTm->scanForNewDevices();

        sleep(2);

        LOG4CPLUS_INFO_EXT(logger, "*************************** Deleting TM and shutting down *****************************");

        // Shutdown transport manager
        delete pTm;
        pTm = 0;

    }