@Test
public void handlingCloseTestAbortXhrPolling() throws Exception {
final SockJsServiceFactory echoFactory = echoService();
final String sessionUrl = echoFactory.config().prefix() + "/000/" + UUID.randomUUID().toString();
final EmbeddedChannel ch = channelForService(echoFactory);
removeLastInboundMessageHandlers(ch);
ch.writeInbound(httpRequest(sessionUrl + Transports.Type.XHR.path(), GET));
final FullHttpResponse response = ch.readOutbound();
assertThat(response.getStatus(), is(HttpResponseStatus.OK));
assertThat(response.content().toString(UTF_8), equalTo("o\n"));
final EmbeddedChannel ch2 = channelForService(echoFactory);
removeLastInboundMessageHandlers(ch2);
ch2.writeInbound(httpRequest(sessionUrl + Transports.Type.XHR.path(), GET));
final FullHttpResponse response2 = ch2.readOutbound();
assertThat(response2.content().toString(UTF_8), equalTo("c[2010,\"Another connection still open\"]\n"));
final EmbeddedChannel ch3 = channelForService(echoFactory);
removeLastInboundMessageHandlers(ch3);
ch3.writeInbound(httpRequest(sessionUrl + Transports.Type.XHR.path(), GET));
final FullHttpResponse response3 = ch3.readOutbound();
assertThat(response3.content().toString(UTF_8), equalTo("c[1002,\"Connection interrupted\"]\n"));
}