[stun4j] How add Optional Attributes during NetworkConfigurationDiscoveryProcess???


#1

Hi,

I am going to implement a STUN client with stun4j.

I found useful and clean APIs and a ready made client in
net.java.stun4j.client.NetworkConfigurationDiscoveryProcess (thank
you!).

But my project requirements includes "STUN Optional Attributes" as
*mandatory* in each binding request message.
What is the best way to add these attributes?

My idea:
I created two OptionalAttribute subclasses names MyAttribute1 and MyAttribute2.

So I modified doTestI(), doTestII() and doTestIII() like:
Request request = MessageFactory.createBindingRequest();
request.addAttribute(myAtttribute1);
request.addAttribute(myAtttribute2);

BUT:
* I can't subclass NetworkConfigurationDiscoveryProcess due to
visibility limitations
* I can't instantiate due to Request scope at package level.

It is reasonable I change Request.java constructor public and change
method signature in NetworkConfigurationDiscoveryProcess to protected
(not private) in order to provide overriding?

Thank you,
Guido