@Test
public void test_sendPacket_binary() {

    final EngineIoServer engineIoServer = new EngineIoServer();
    final SocketIoServer socketIoServer = new SocketIoServer(engineIoServer);
    final EngineIoWebSocket webSocket = Mockito.spy(new EngineIoWebSocketImpl());
    final Emitter.Listener connectionListener = Mockito.mock(Emitter.Listener.class);
    Mockito.doAnswer(invocation -> {
        final Object[] args = invocation.getArguments();
        final EngineIoSocket socket = (EngineIoSocket) args[0];
        final SocketIoClient client = new SocketIoClient(socketIoServer, socket);
        final JSONArray packetData = new JSONArray();
        packetData.put("foo");
        packetData.put(1);
        packetData.put(new byte[16]);
        final Packet<JSONArray> packet = new Packet<>(Parser.EVENT, packetData);
        try {
            Mockito.reset(webSocket);
            client.sendPacket(packet);
            Mockito.verify(webSocket, Mockito.times(1))
                    .write(Mockito.anyString());
            Mockito.verify(webSocket, Mockito.times(1))
                    .write(Mockito.any(byte[].class));
        } catch (IOException ignore) {
        }
        return null;
    }).when(connectionListener).call(Mockito.any());
    engineIoServer.on("connection", connectionListener);
    engineIoServer.handleWebSocket(webSocket);
    Mockito.verify(connectionListener, Mockito.times(1))
            .call(Mockito.any(EngineIoSocket.class));
}