jeudi 27 avril 2017

How to unit-test channelWritabilityChanged

I am writing a netty server. To handle the slow consumer situation, I use channelWritabilityChanged to detect when the channel becomes un-writable. So how can I write test for this?

I haved tried to use EmbeddedChannel with my InboundHandler, but when I do a EmbeddedChannel.writeOutbound to write something big, the writability changes twice (change to un-writable, and then writable again). It seems that when EmbeddedChannel flushes, the channel will become writable.

Since I cannot use EmbeddedChannel, how can I unit-test my code? How can I create a local channel and write something big to it?

Aucun commentaire:

Enregistrer un commentaire