ServerWebSocketContainer builder = new ServerWebSocketContainer(TestClassIntrospector.INSTANCE, DefaultServer.getWorker(), new ByteBufferSlicePool(100, 100), new CompositeThreadSetupAction(Collections.EMPTY_LIST), false, false);
builder.addEndpoint(ServerEndpointConfig.Builder.create(TestEndPoint.class, "/").configurator(new InstanceConfigurator(new TestEndPoint())).build());
deployServlet(builder);
WebSocketTestClient client = new WebSocketTestClient(getVersion(), new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/"));
client.connect();
client.send(new CloseWebSocketFrame(code, null), new FrameChecker(CloseWebSocketFrame.class, payload.array(), latch));
if(latch.getIoFuture().await(10, TimeUnit.SECONDS) != IoFuture.Status.DONE) {
Assert.fail();
}
latch.getIoFuture().get();
clientLatch.await();
Assert.assertEquals(code, reason.get().getCloseCode().getCode());
Assert.assertEquals("", reason.get().getReasonPhrase());
Assert.assertEquals(1, closeCount.get());
client.destroy();
}