public void testRunInMiddleOfPacket() throws Exception {
		log.fine("B*******************************************");
		clientEngine.beginHandshake();
		CalledMethod m = clientList.expect("packetEncrypted");
		ByteBuffer b = (ByteBuffer)m.getAllParams()[0];
		
		serverEngine.feedEncryptedPacket(b, null);
		m = serverList.expect("runTask");
		Runnable r = (Runnable)m.getAllParams()[0];

		r.run();
		m = serverList.expect("packetEncrypted");
		b = (ByteBuffer)m.getAllParams()[0];

		clientEngine.feedEncryptedPacket(b, null);
		m = clientList.expect("runTask");
		r = (Runnable)m.getAllParams()[0];

		r.run();
		String[] methodNames = new String[3];
		methodNames[0] = "packetEncrypted";
		methodNames[1] = "packetEncrypted";
		methodNames[2] = "packetEncrypted";
		CalledMethod[] methods = clientList.expect(methodNames);
		
		ByteBuffer b0 = (ByteBuffer)methods[0].getAllParams()[0];
		ByteBuffer b1 = (ByteBuffer)methods[1].getAllParams()[0];
		ByteBuffer b2 = (ByteBuffer)methods[2].getAllParams()[0];
		
		serverEngine.feedEncryptedPacket(b0, null);
		m = serverList.expect("runTask");
		r = (Runnable)m.getAllParams()[0];
	
		int total = b1.remaining()+b2.remaining();
		ByteBuffer combined = ByteBuffer.allocate(total);
		
		int lim = b1.limit();
		b1.limit(3); //we only want to put part of b1 in payload
		combined.put(b1);
		helper.doneFillingBuffer(combined);
		serverEngine.feedEncryptedPacket(combined, null);
		
		//run the task after some of the previous packet fed, then feed rest of packet
		r.run();
		
		combined.clear();
		b1.limit(lim);
		combined.put(b1);
		combined.put(b2);
		
		helper.doneFillingBuffer(combined);
		serverEngine.feedEncryptedPacket(combined, null);
		
		String[] methodNames1 = new String[3];
		methodNames1[0] = "packetEncrypted";
		methodNames1[1] = "packetEncrypted";
		methodNames1[2] = "encryptedLinkEstablished";
		CalledMethod[] methods1 = serverList.expect(methodNames1);
		
		b0 = (ByteBuffer)methods1[0].getAllParams()[0];		
		clientEngine.feedEncryptedPacket(b0, null);
		b1 = (ByteBuffer)methods1[1].getAllParams()[0];
		clientEngine.feedEncryptedPacket(b1, null);
		
		clientList.expect("encryptedLinkEstablished");		
	}