### Question:
WebsocketRequestLog { public void log(String remoteAddress, ContainerRequest jerseyRequest, ContainerResponse jettyResponse) { WebsocketEvent event = new WebsocketEvent(remoteAddress, jerseyRequest, jettyResponse); if (getFilterChainDecision(event) == FilterReply.DENY) { return; } aai.appendLoopOnAppenders(event); } WebsocketRequestLog(); void log(String remoteAddress, ContainerRequest jerseyRequest, ContainerResponse jettyResponse); void addAppender(Appender<WebsocketEvent> newAppender); void addFilter(Filter<WebsocketEvent> newFilter); FilterReply getFilterChainDecision(WebsocketEvent event);  }### Answer:
@Test public void testLogLineWithoutHeaders() throws InterruptedException { WebSocketSessionContext sessionContext = mock(WebSocketSessionContext.class); ListAppender<WebsocketEvent> listAppender = new ListAppender<>(); WebsocketRequestLoggerFactory requestLoggerFactory = new WebsocketRequestLoggerFactory(); requestLoggerFactory.appenders = List.of(new ListAppenderFactory<>(listAppender)); WebsocketRequestLog requestLog = requestLoggerFactory.build("test-logger"); ContainerRequest request = new ContainerRequest (null, URI.create("/v1/test"), "GET", new WebSocketSecurityContext(new ContextPrincipal(sessionContext)), new MapPropertiesDelegate(new HashMap<>()), null); ContainerResponse response = new ContainerResponse(request, Response.ok("My response body").build()); requestLog.log("123.456.789.123", request, response); listAppender.waitForListSize(1); assertThat(listAppender.list.size()).isEqualTo(1); String loggedLine = new String(listAppender.outputStream.toByteArray()); assertThat(loggedLine.matches("123\\.456\\.789\\.123 \\- \\- \\[[0-9]{2}\\/[a-zA-Z]{3}\\/[0-9]{4}:[0-9]{2}:[0-9]{2}:[0-9]{2} \\-[0-9]{4}\\] \"GET \\/v1\\/test WS\" 200 \\- \"\\-\" \"\\-\"\n")).isTrue(); }
@Test public void testLogLineWithHeaders() throws InterruptedException { WebSocketSessionContext sessionContext = mock(WebSocketSessionContext.class); ListAppender<WebsocketEvent> listAppender = new ListAppender<>(); WebsocketRequestLoggerFactory requestLoggerFactory = new WebsocketRequestLoggerFactory(); requestLoggerFactory.appenders = List.of(new ListAppenderFactory<>(listAppender)); WebsocketRequestLog requestLog = requestLoggerFactory.build("test-logger"); ContainerRequest request = new ContainerRequest (null, URI.create("/v1/test"), "GET", new WebSocketSecurityContext(new ContextPrincipal(sessionContext)), new MapPropertiesDelegate(new HashMap<>()), null); request.header("User-Agent", "SmertZeSmert"); request.header("Referer", "https: ContainerResponse response = new ContainerResponse(request, Response.ok("My response body").build()); requestLog.log("123.456.789.123", request, response); listAppender.waitForListSize(1); assertThat(listAppender.list.size()).isEqualTo(1); String loggedLine = new String(listAppender.outputStream.toByteArray()); assertThat(loggedLine.matches("123\\.456\\.789\\.123 \\- \\- \\[[0-9]{2}\\/[a-zA-Z]{3}\\/[0-9]{4}:[0-9]{2}:[0-9]{2}:[0-9]{2} \\-[0-9]{4}\\] \"GET \\/v1\\/test WS\" 200 \\- \"https: System.out.println(listAppender.list.get(0)); System.out.println(new String(listAppender.outputStream.toByteArray())); }