本文整理汇总了Java中org.apache.catalina.Context.addApplicationListener方法的典型用法代码示例。如果您正苦于以下问题:Java Context.addApplicationListener方法的具体用法?Java Context.addApplicationListener怎么用?Java Context.addApplicationListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.Context
的用法示例。
在下文中一共展示了Context.addApplicationListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testClientDropsConnection
import org.apache.catalina.Context; //导入方法依赖的package包/类
@Test
public void testClientDropsConnection() throws Exception {
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
ctx.addApplicationListener(Bug58624Config.class.getName());
Tomcat.addServlet(ctx, "default", new DefaultServlet());
ctx.addServletMapping("/", "default");
WebSocketContainer wsContainer =
ContainerProvider.getWebSocketContainer();
tomcat.start();
SimpleClient client = new SimpleClient();
URI uri = new URI("ws://localhost:" + getPort() + Bug58624Config.PATH);
Session session = wsContainer.connectToServer(client, uri);
// Break point A required on following line
session.close();
}
示例2: testServletContextListener
import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
* Check that a {@link ServletContextListener} cannot install a
* {@link javax.servlet.ServletContainerInitializer}.
* @throws Exception
*/
@Test
public void testServletContextListener() throws Exception {
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context context = tomcat.addContext("", null);
// SCL2 pretends to be in web.xml, and tries to install a
// ServletContainerInitializer.
context.addApplicationListener(SCL2.class.getName());
tomcat.start();
//check that the ServletContainerInitializer wasn't initialized.
assertFalse(SCL3.initialized);
}
示例3: testConnectToServerEndpointInvalidScheme
import org.apache.catalina.Context; //导入方法依赖的package包/类
@Test(expected=javax.websocket.DeploymentException.class)
public void testConnectToServerEndpointInvalidScheme() throws Exception {
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
tomcat.start();
WebSocketContainer wsContainer =
ContainerProvider.getWebSocketContainer();
wsContainer.connectToServer(TesterProgrammaticEndpoint.class,
ClientEndpointConfig.Builder.create().build(),
new URI("ftp://" + getHostName() + ":" + getPort() +
TesterEchoServer.Config.PATH_ASYNC));
}
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:17,代码来源:TestWsWebSocketContainer.java
示例4: testOnOpenPojoMethod
import org.apache.catalina.Context; //导入方法依赖的package包/类
@Test
public void testOnOpenPojoMethod() throws Exception {
// Set up utility classes
OnOpenServerEndpoint server = new OnOpenServerEndpoint();
SingletonConfigurator.setInstance(server);
ServerConfigListener.setPojoClazz(OnOpenServerEndpoint.class);
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
ctx.addApplicationListener(ServerConfigListener.class.getName());
Tomcat.addServlet(ctx, "default", new DefaultServlet());
ctx.addServletMapping("/", "default");
WebSocketContainer wsContainer =
ContainerProvider.getWebSocketContainer();
tomcat.start();
Client client = new Client();
URI uri = new URI("ws://localhost:" + getPort() + "/");
Session session = wsContainer.connectToServer(client, uri);
client.waitForClose(5);
Assert.assertTrue(session.isOpen());
}
示例5: testConnectToServerEndpoint
import org.apache.catalina.Context; //导入方法依赖的package包/类
@Test
public void testConnectToServerEndpoint() throws Exception {
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
Tomcat.addServlet(ctx, "default", new DefaultServlet());
ctx.addServletMapping("/", "default");
tomcat.start();
WebSocketContainer wsContainer =
ContainerProvider.getWebSocketContainer();
// Set this artificially small to trigger
// https://bz.apache.org/bugzilla/show_bug.cgi?id=57054
wsContainer.setDefaultMaxBinaryMessageBufferSize(64);
Session wsSession = wsContainer.connectToServer(
TesterProgrammaticEndpoint.class,
ClientEndpointConfig.Builder.create().build(),
new URI("ws://" + getHostName() + ":" + getPort() +
TesterEchoServer.Config.PATH_ASYNC));
CountDownLatch latch = new CountDownLatch(1);
BasicText handler = new BasicText(latch);
wsSession.addMessageHandler(handler);
wsSession.getBasicRemote().sendText(MESSAGE_STRING_1);
boolean latchResult = handler.getLatch().await(10, TimeUnit.SECONDS);
Assert.assertTrue(latchResult);
Queue<String> messages = handler.getMessages();
Assert.assertEquals(1, messages.size());
Assert.assertEquals(MESSAGE_STRING_1, messages.peek());
((WsWebSocketContainer) wsContainer).destroy();
}
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:37,代码来源:TestWsWebSocketContainer.java
示例6: testOnErrorNotCalledWhenClosingConnection
import org.apache.catalina.Context; //导入方法依赖的package包/类
@Test
public void testOnErrorNotCalledWhenClosingConnection() throws Throwable {
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
ctx.addApplicationListener(Bug58624ServerConfig.class.getName());
Tomcat.addServlet(ctx, "default", new DefaultServlet());
ctx.addServletMapping("/", "default");
WebSocketContainer wsContainer = ContainerProvider.getWebSocketContainer();
tomcat.start();
Bug58624ClientEndpoint client = new Bug58624ClientEndpoint();
URI uri = new URI("ws://localhost:" + getPort() + Bug58624ServerConfig.PATH);
Session session = wsContainer.connectToServer(client, uri);
// Wait for session to open on the server
int count = 0;
while (count < 50 && Bug58624ServerEndpoint.getOpenSessionCount() == 0) {
count++;
Thread.sleep(100);
}
Assert.assertNotEquals(0, Bug58624ServerEndpoint.getOpenSessionCount());
// Now close the session
session.close();
// Wait for session to close on the server
count = 0;
while (count < 50 && Bug58624ServerEndpoint.getOpenSessionCount() > 0) {
count++;
Thread.sleep(100);
}
Assert.assertEquals(0, Bug58624ServerEndpoint.getOpenSessionCount());
// Ensure no errors were reported on the server
Assert.assertEquals(0, Bug58624ServerEndpoint.getErrorCount());
if (client.getError() != null) {
throw client.getError();
}
}
示例7: doTestDispatchError
import org.apache.catalina.Context; //导入方法依赖的package包/类
private void doTestDispatchError(int iter, boolean useThread,
boolean completeOnError)
throws Exception {
resetTracker();
// Setup Tomcat instance
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
DispatchingServlet dispatch =
new DispatchingServlet(true, completeOnError);
Wrapper wrapper = Tomcat.addServlet(ctx, "dispatch", dispatch);
wrapper.setAsyncSupported(true);
ctx.addServletMapping("/stage1", "dispatch");
ErrorServlet error = new ErrorServlet();
Tomcat.addServlet(ctx, "error", error);
ctx.addServletMapping("/stage2", "error");
ctx.addApplicationListener(TrackingRequestListener.class.getName());
TesterAccessLogValve alv = new TesterAccessLogValve();
ctx.getPipeline().addValve(alv);
tomcat.start();
StringBuilder url = new StringBuilder(48);
url.append("http://localhost:");
url.append(getPort());
url.append("/stage1?iter=");
url.append(iter);
if (useThread) {
url.append("&useThread=y");
}
getUrl(url.toString());
StringBuilder expected = new StringBuilder("requestInitialized-");
int loop = iter;
while (loop > 0) {
expected.append("DispatchingServletGet-");
if (loop != iter) {
expected.append("onStartAsync-");
}
loop--;
}
expected.append("ErrorServletGet-onError-onComplete-requestDestroyed");
// Request may complete before listener has finished processing so wait
// up to 5 seconds for the right response
String expectedTrack = expected.toString();
int count = 0;
while (!expectedTrack.equals(getTrack()) && count < 100) {
Thread.sleep(50);
count ++;
}
assertEquals(expectedTrack, getTrack());
// Check the access log
alv.validateAccessLog(1, 500, 0, REQUEST_TIME);
}
示例8: testBug54239
import org.apache.catalina.Context; //导入方法依赖的package包/类
@Test
public void testBug54239() throws Exception {
Tomcat tomcat = getTomcatInstance();
File appDir = new File("test/webapp-3.0");
Context ctx = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
tomcat.start();
ServletContext context = ctx.getServletContext();
ELInterpreter interpreter =
ELInterpreterFactory.getELInterpreter(context);
Assert.assertNotNull(interpreter);
Assert.assertTrue(interpreter instanceof DefaultELInterpreter);
context.removeAttribute(ELInterpreter.class.getName());
context.setAttribute(ELInterpreter.class.getName(),
SimpleELInterpreter.class.getName());
interpreter = ELInterpreterFactory.getELInterpreter(context);
Assert.assertNotNull(interpreter);
Assert.assertTrue(interpreter instanceof SimpleELInterpreter);
context.removeAttribute(ELInterpreter.class.getName());
SimpleELInterpreter simpleInterpreter = new SimpleELInterpreter();
context.setAttribute(ELInterpreter.class.getName(), simpleInterpreter);
interpreter = ELInterpreterFactory.getELInterpreter(context);
Assert.assertNotNull(interpreter);
Assert.assertTrue(interpreter instanceof SimpleELInterpreter);
Assert.assertTrue(interpreter == simpleInterpreter);
context.removeAttribute(ELInterpreter.class.getName());
ctx.stop();
ctx.addApplicationListener(Bug54239Listener.class.getName());
ctx.start();
interpreter = ELInterpreterFactory.getELInterpreter(ctx.getServletContext());
Assert.assertNotNull(interpreter);
Assert.assertTrue(interpreter instanceof SimpleELInterpreter);
}
示例9: setup
import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
* Sets up a store.
* @throws Throwable Throws uncaught throwables for test to fail.
*/
@Before
public void setup() throws Throwable {
storeTomcat = new Tomcat();
storeTomcat.setPort(3000);
storeTomcat.setBaseDir(testWorkingDir);
storeTomcat.enableNaming();
Context context3 = storeTomcat.addWebapp("/tools.descartes.petsupplystore.store", testWorkingDir);
ContextEnvironment registryURL3 = new ContextEnvironment();
registryURL3.setDescription("");
registryURL3.setOverride(false);
registryURL3.setType("java.lang.String");
registryURL3.setName("registryURL");
registryURL3.setValue("http://localhost:18080/tools.descartes.petsupplystore.registry/rest/services/");
context3.getNamingResources().addEnvironment(registryURL3);
ContextEnvironment servicePort3 = new ContextEnvironment();
servicePort3.setDescription("");
servicePort3.setOverride(false);
servicePort3.setType("java.lang.String");
servicePort3.setName("servicePort");
servicePort3.setValue("3000");
context3.getNamingResources().addEnvironment(servicePort3);
ResourceConfig restServletConfig3 = new ResourceConfig();
restServletConfig3.register(StoreCartREST.class);
restServletConfig3.register(StoreCategoriesREST.class);
restServletConfig3.register(StoreProductREST.class);
restServletConfig3.register(StoreUserActionsREST.class);
restServletConfig3.register(StoreUserREST.class);
ServletContainer restServlet3 = new ServletContainer(restServletConfig3);
storeTomcat.addServlet("/tools.descartes.petsupplystore.store", "restServlet", restServlet3);
context3.addServletMappingDecoded("/rest/*", "restServlet");
context3.addApplicationListener(EmptyStoreStartup.class.getName());
// Mock registry
List<String> strings = new LinkedList<String>();
strings.add("localhost:18080");
String json = new ObjectMapper().writeValueAsString(strings);
List<String> strings2 = new LinkedList<String>();
strings2.add("localhost:3000");
String json2 = new ObjectMapper().writeValueAsString(strings2);
wireMockRule.stubFor(get(urlEqualTo(
"/tools.descartes.petsupplystore.registry/rest/services/" + Service.IMAGE.getServiceName() + "/"))
.willReturn(okJson(json)));
wireMockRule.stubFor(get(urlEqualTo(
"/tools.descartes.petsupplystore.registry/rest/services/" + Service.STORE.getServiceName() + "/"))
.willReturn(okJson(json2)));
wireMockRule.stubFor(WireMock.put(WireMock.urlMatching(
"/tools.descartes.petsupplystore.registry/rest/services/" + Service.STORE.getServiceName() + "/.*"))
.willReturn(okJson(json2)));
wireMockRule.stubFor(WireMock.delete(WireMock.urlMatching(
"/tools.descartes.petsupplystore.registry/rest/services/" + Service.STORE.getServiceName() + "/.*"))
.willReturn(okJson(json2)));
wireMockRule.stubFor(get(urlEqualTo(
"/tools.descartes.petsupplystore.registry/rest/services/" + Service.PERSISTENCE.getServiceName() + "/"))
.willReturn(okJson(json)));
wireMockRule.stubFor(get(urlEqualTo(
"/tools.descartes.petsupplystore.registry/rest/services/" + Service.RECOMMENDER.getServiceName() + "/"))
.willReturn(okJson(json)));
// Mock images
HashMap<String, String> img = new HashMap<>();
img.put("andreBauer", "andreBauer");
img.put("johannesGrohmann", "johannesGrohmann");
img.put("joakimKistowski", "joakimKistowski");
img.put("simonEismann", "simonEismann");
img.put("norbertSchmitt", "norbertSchmitt");
img.put("descartesLogo", "descartesLogo");
img.put("icon", "icon");
mockValidPostRestCall(img, "/tools.descartes.petsupplystore.image/rest/image/getWebImages");
storeTomcat.start();
}
示例10: doTestDispatch
import org.apache.catalina.Context; //导入方法依赖的package包/类
private void doTestDispatch(int iter, boolean useThread) throws Exception {
resetTracker();
// Setup Tomcat instance
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
DispatchingServlet dispatch = new DispatchingServlet(false, false);
Wrapper wrapper = Tomcat.addServlet(ctx, "dispatch", dispatch);
wrapper.setAsyncSupported(true);
ctx.addServletMapping("/stage1", "dispatch");
NonAsyncServlet nonasync = new NonAsyncServlet();
Wrapper wrapper2 = Tomcat.addServlet(ctx, "nonasync", nonasync);
wrapper2.setAsyncSupported(true);
ctx.addServletMapping("/stage2", "nonasync");
ctx.addApplicationListener(TrackingRequestListener.class.getName());
TesterAccessLogValve alv = new TesterAccessLogValve();
ctx.getPipeline().addValve(alv);
tomcat.start();
StringBuilder url = new StringBuilder(48);
url.append("http://localhost:");
url.append(getPort());
url.append("/stage1?iter=");
url.append(iter);
if (useThread) {
url.append("&useThread=y");
}
getUrl(url.toString());
StringBuilder expected = new StringBuilder("requestInitialized-");
int loop = iter;
while (loop > 0) {
expected.append("DispatchingServletGet-");
loop--;
}
expected.append("NonAsyncServletGet-");
expected.append("requestDestroyed");
// Request may complete before listener has finished processing so wait
// up to 5 seconds for the right response
String expectedTrack = expected.toString();
int count = 0;
while (!expectedTrack.equals(getTrack()) && count < 100) {
Thread.sleep(50);
count ++;
}
assertEquals(expectedTrack, getTrack());
// Check the access log
alv.validateAccessLog(1, 200, 0, REQUEST_TIME);
}
示例11: testGetOpenSessions
import org.apache.catalina.Context; //导入方法依赖的package包/类
@Test
public void testGetOpenSessions() throws Exception {
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
Tomcat.addServlet(ctx, "default", new DefaultServlet());
ctx.addServletMapping("/", "default");
tomcat.start();
WebSocketContainer wsContainer =
ContainerProvider.getWebSocketContainer();
EndpointA endpointA = new EndpointA();
Session s1a = connectToEchoServer(wsContainer, endpointA,
TesterEchoServer.Config.PATH_BASIC);
Session s2a = connectToEchoServer(wsContainer, endpointA,
TesterEchoServer.Config.PATH_BASIC);
Session s3a = connectToEchoServer(wsContainer, endpointA,
TesterEchoServer.Config.PATH_BASIC);
EndpointB endpointB = new EndpointB();
Session s1b = connectToEchoServer(wsContainer, endpointB,
TesterEchoServer.Config.PATH_BASIC);
Session s2b = connectToEchoServer(wsContainer, endpointB,
TesterEchoServer.Config.PATH_BASIC);
Set<Session> setA = s3a.getOpenSessions();
Assert.assertEquals(3, setA.size());
Assert.assertTrue(setA.remove(s1a));
Assert.assertTrue(setA.remove(s2a));
Assert.assertTrue(setA.remove(s3a));
s1a.close();
setA = s3a.getOpenSessions();
Assert.assertEquals(2, setA.size());
Assert.assertFalse(setA.remove(s1a));
Assert.assertTrue(setA.remove(s2a));
Assert.assertTrue(setA.remove(s3a));
Set<Session> setB = s1b.getOpenSessions();
Assert.assertEquals(2, setB.size());
Assert.assertTrue(setB.remove(s1b));
Assert.assertTrue(setB.remove(s2b));
// Close sessions explicitly as Gump reports a session remains open at
// the end of this test
s2a.close();
s3a.close();
s1b.close();
s2b.close();
}
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:55,代码来源:TestWsWebSocketContainer.java
示例12: test
import org.apache.catalina.Context; //导入方法依赖的package包/类
@Test
public void test() throws Exception {
// Set up utility classes
Server server = new Server();
SingletonConfigurator.setInstance(server);
ServerConfigListener.setPojoClazz(Server.class);
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
ctx.addApplicationListener(ServerConfigListener.class.getName());
Tomcat.addServlet(ctx, "default", new DefaultServlet());
ctx.addServletMapping("/", "default");
WebSocketContainer wsContainer =
ContainerProvider.getWebSocketContainer();
tomcat.start();
SimpleClient client = new SimpleClient();
URI uri = new URI("ws://localhost:" + getPort() + "/" + PARAM_ONE +
"/" + PARAM_TWO + "/" + PARAM_THREE);
Session session = wsContainer.connectToServer(client, uri);
session.getBasicRemote().sendText("NO-OP");
session.close();
// Give server 20s to close. 5s should be plenty but the Gump VM is slow
int count = 0;
while (count < 200) {
if (server.isClosed()) {
break;
}
count++;
Thread.sleep(100);
}
if (count == 50) {
Assert.fail("Server did not process an onClose event within 5 " +
"seconds of the client sending a close message");
}
// Check no errors
List<String> errors = server.getErrors();
for (String error : errors) {
System.err.println(error);
}
Assert.assertEquals("Found errors", 0, errors.size());
}
示例13: testProgrammaticEndPoints
import org.apache.catalina.Context; //导入方法依赖的package包/类
@Test
public void testProgrammaticEndPoints() throws Exception{
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
ctx.addApplicationListener(
ProgramaticServerEndpointConfig.class.getName());
Tomcat.addServlet(ctx, "default", new DefaultServlet());
ctx.addServletMapping("/", "default");
WebSocketContainer wsContainer = ContainerProvider.getWebSocketContainer();
tomcat.start();
Client client = new Client();
URI uri = new URI("ws://localhost:" + getPort() + PATH_PROGRAMMATIC_EP);
Session session = wsContainer.connectToServer(client, uri);
MsgString msg1 = new MsgString();
msg1.setData(MESSAGE_ONE);
session.getBasicRemote().sendObject(msg1);
// Should not take very long
int i = 0;
while (i < 20) {
if (MsgStringMessageHandler.received.size() > 0 &&
client.received.size() > 0) {
break;
}
Thread.sleep(100);
i++;
}
// Check messages were received
Assert.assertEquals(1, MsgStringMessageHandler.received.size());
Assert.assertEquals(1, client.received.size());
// Check correct messages were received
Assert.assertEquals(MESSAGE_ONE,
((MsgString) MsgStringMessageHandler.received.peek()).getData());
Assert.assertEquals(MESSAGE_ONE,
new String(((MsgByte) client.received.peek()).getData()));
session.close();
}
示例14: testConnectToServerEndpoint
import org.apache.catalina.Context; //导入方法依赖的package包/类
@Test
public void testConnectToServerEndpoint() throws Exception {
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
ctx.addApplicationListener(TesterFirehoseServer.Config.class.getName());
Tomcat.addServlet(ctx, "default", new DefaultServlet());
ctx.addServletMapping("/", "default");
tomcat.start();
WebSocketContainer wsContainer =
ContainerProvider.getWebSocketContainer();
ClientEndpointConfig clientEndpointConfig =
ClientEndpointConfig.Builder.create().build();
Session wsSession = wsContainer.connectToServer(
TesterProgrammaticEndpoint.class,
clientEndpointConfig,
new URI("ws://localhost:" + getPort() +
TesterFirehoseServer.Config.PATH));
CountDownLatch latch =
new CountDownLatch(TesterFirehoseServer.MESSAGE_COUNT);
BasicText handler = new BasicText(latch);
wsSession.addMessageHandler(handler);
wsSession.getBasicRemote().sendText("Hello");
System.out.println("Sent Hello message, waiting for data");
// Ignore the latch result as the message count test below will tell us
// if the right number of messages arrived
handler.getLatch().await(TesterFirehoseServer.WAIT_TIME_MILLIS,
TimeUnit.MILLISECONDS);
Queue<String> messages = handler.getMessages();
Assert.assertEquals(
TesterFirehoseServer.MESSAGE_COUNT, messages.size());
for (String message : messages) {
Assert.assertEquals(TesterFirehoseServer.MESSAGE, message);
}
}
示例15: testGenericsCoders
import org.apache.catalina.Context; //导入方法依赖的package包/类
@Test
public void testGenericsCoders() throws Exception {
// Set up utility classes
GenericsServer server = new GenericsServer();
SingletonConfigurator.setInstance(server);
ServerConfigListener.setPojoClazz(GenericsServer.class);
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
ctx.addApplicationListener(ServerConfigListener.class.getName());
Tomcat.addServlet(ctx, "default", new DefaultServlet());
ctx.addServletMapping("/", "default");
WebSocketContainer wsContainer =
ContainerProvider.getWebSocketContainer();
tomcat.start();
GenericsClient client = new GenericsClient();
URI uri = new URI("ws://localhost:" + getPort() + PATH_GENERICS_EP);
Session session = wsContainer.connectToServer(client, uri);
ArrayList<String> list = new ArrayList<String>(2);
list.add("str1");
list.add("str2");
session.getBasicRemote().sendObject(list);
// Should not take very long
int i = 0;
while (i < 20) {
if (server.received.size() > 0 && client.received.size() > 0) {
break;
}
Thread.sleep(100);
}
// Check messages were received
Assert.assertEquals(1, server.received.size());
Assert.assertEquals(server.received.peek().toString(), "[str1, str2]");
Assert.assertEquals(1, client.received.size());
Assert.assertEquals(client.received.peek().toString(), "[str1, str2]");
session.close();
}