use of com.tvd12.ezyfoxserver.nio.websocket.EzyWsHandlerGroup in project ezyfox-server by youngmonkeys.
the class EzySimpleWsHandlerGroupTest method newDecodeBytesCallbackCallTest.
@Test
public void newDecodeBytesCallbackCallTest() throws Exception {
// given
EzyWsHandlerGroup sut = newHandlerGroup();
EzyCallback<Object> decodeBytesCallback = FieldUtil.getFieldValue(sut, "decodeBytesCallback");
// when
Throwable e = Asserts.assertThrows(() -> decodeBytesCallback.call(new Object()));
// then
Asserts.assertEquals(UnsupportedOperationException.class, e.getClass());
}
use of com.tvd12.ezyfoxserver.nio.websocket.EzyWsHandlerGroup in project ezyfox-server by youngmonkeys.
the class EzySimpleWsHandlerGroupTest method handleReceivedSessionStreamNotEnable.
@Test
public void handleReceivedSessionStreamNotEnable() throws Exception {
// given
EzyWsHandlerGroup sut = newHandlerGroup();
EzySession session = FieldUtil.getFieldValue(sut, "session");
byte[] bytes = new byte[] { 1 << 4, 2, 3 };
int offset = 0;
int len = 3;
// when
MethodInvoker.create().object(sut).method("handleReceivedBytes").param(byte[].class, bytes).param(int.class, offset).param(int.class, len).call();
// then
verify(session, times(1)).isStreamingEnable();
}
use of com.tvd12.ezyfoxserver.nio.websocket.EzyWsHandlerGroup in project ezyfox-server by youngmonkeys.
the class EzySimpleWsHandlerGroupTest method handleReceivedStreamEnableAndSessionStream.
@Test
public void handleReceivedStreamEnableAndSessionStream() throws Exception {
// given
EzyWsHandlerGroup sut = newHandlerGroup();
EzySession session = FieldUtil.getFieldValue(sut, "session");
when(session.isStreamingEnable()).thenReturn(true);
byte[] bytes = new byte[] { 1 << 4, 2, 3 };
int offset = 0;
int len = 3;
// when
MethodInvoker.create().object(sut).method("handleReceivedBytes").param(byte[].class, bytes).param(int.class, offset).param(int.class, len).call();
// then
verify(session, times(1)).isStreamingEnable();
}
Aggregations