Open TTransmit opened 3 years ago
@TTransmit: Thanks for your bug report. Would you like to create a PR for this issue?
We use mockwebserver for mocking kubernetes API responses. There we can wait for a certain period of time and emit responses. See an example here: https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DefaultSharedIndexInformerTest.java#L87
I have an issue with my WebSocket setup that the client Android app occasionally doesn't respond to a ping of the PingFrame fast enough with a pong. This causes the web socket server to return a close frame. This is fine except that there is a bug in the reconnection logic of my app that means it occasionally doesn't reconnect. I want to be able to replicate the bug caused by the close frames being received reliably.
OkHTTP has SocketPolicy. Is there a recommended way to use SocketPolicy with MockWebServer? I've been struggling to understand how to implement SocketPolicy with either OkHTTP's MockWebServer or fabric8io's MockWebServer.
Another very nice solution would be if I could send a close frame in response to a certain message or after a certain time. e.g.
.andEmit(CloseFrame())