Question about program of opcua dirver (AbstractNioDriver)

I write a java tcp server which listen on port XXX to test my opcua driver ,when tcp server receive a message,it will responde some message( It has been tested by java client TCP program);

I implement the function “sendMessage” and “receiveMessage” of Class AbstractReadRequest,
In sendMessage, I use writeToChannel to send the message to the tcp server ,it succeed.
but receiveMessage didn’t run so it indicate there is no responded message arrived ,and in console ,it always shows the message :

TimeoutDaemon ScheduledRequest :   request with key "0" failed due to timeout. 

What is the problem ,thank you very much

This is another issue that you probably would have figured out if the Javadocs weren’t missing protected methods.

In your AbstractNioDriver subclass you have overridden messageLength(ByteBuffer buffer). The implementation of this is important.

	 * <p>
	 * Search the given ByteBuffer starting at its current position looking for a message and return
	 * the length in bytes of the next message in the buffer. If there is not enough information in
	 * the buffer to determine the length of the next message, return -1.
	 * </p>
	 * <p>
	 * This function should only make calls to {@link ByteBuffer#get()} and friends. Only the
	 * buffer's position should ever be modified by this function; it should leave the mark and
	 * limit alone.
	 * </p>
	 * @param buffer
	 *            A ByteBuffer containing bytes that have come in off the wire.
	 * @return The length of the next message in the buffer, or -1 if there is not enough
	 *         information to determine the length.
	protected abstract int messageLength(ByteBuffer buffer);

Your requests won’t have anything delivered to them until it has been determined that an entire message has arrived.

thank you very much!
Can you give me more detail about fuction “getRequestKey(byte[] message)” ,It seems only get the key of received message ,not sended message.
please tell me more about the “key”.

Answered here.