Skip to content

Commit

Permalink
Remove invalid test.
Browse files Browse the repository at this point in the history
From section 2.1.5 of the WebSocket 1.1 specification:
"If the close was initiated by the remote peer, the implementation must use the close code and reason sent in the WebSocket protocol close frame."
So even though the sending of the server's close frame fails, the server endpoint still must see the close code from the client.

Enable tests now they all pass.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1719334 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Dec 11, 2015
1 parent cc7079e commit da1ac1b
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions test/org/apache/tomcat/websocket/server/TestClose.java
Expand Up @@ -35,7 +35,7 @@

import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
//import org.junit.Ignore;
import org.junit.Test;

import org.apache.catalina.Context;
Expand All @@ -49,7 +49,7 @@
/**
* Test the behavior of closing websockets under various conditions.
*/
@Ignore // Only because they don't pass at the moment.
//@Ignore // Only because they don't pass at the moment.
public class TestClose extends TomcatBaseTest {

private static Log log = LogFactory.getLog(TestClose.class);
Expand Down Expand Up @@ -197,23 +197,6 @@ public void testTcpResetInOnMessage() throws Exception {
}


@Test
public void testWsCloseThenTcpCloseInOnMessage() throws Exception {
startServer(TestEndpointConfig.class);

TesterWsCloseClient client = new TesterWsCloseClient("localhost", getPort());
client.httpUpgrade(BaseEndpointConfig.PATH);
client.sendMessage("Test");
awaitLatch(events.onMessageCalled, "onMessage not called");

client.sendCloseFrame(CloseCodes.NORMAL_CLOSURE);
client.closeSocket();
events.onMessageWait.countDown();

awaitOnClose(CloseCodes.CLOSED_ABNORMALLY);
}


@Test
public void testTcpCloseWhenOnMessageSends() throws Exception {
events.onMessageSends = true;
Expand All @@ -231,13 +214,26 @@ public void testTcpResetWhenOnMessageSends() throws Exception {
@Test
public void testWsCloseThenTcpCloseWhenOnMessageSends() throws Exception {
events.onMessageSends = true;
testWsCloseThenTcpCloseInOnMessage();

startServer(TestEndpointConfig.class);

TesterWsCloseClient client = new TesterWsCloseClient("localhost", getPort());
client.httpUpgrade(BaseEndpointConfig.PATH);
client.sendMessage("Test");
awaitLatch(events.onMessageCalled, "onMessage not called");

client.sendCloseFrame(CloseCodes.NORMAL_CLOSURE);
client.closeSocket();
events.onMessageWait.countDown();

awaitOnClose(CloseCodes.CLOSED_ABNORMALLY);
}


@Test
public void testWsCloseThenTcpResetWhenOnMessageSends() throws Exception {
events.onMessageSends = true;

startServer(TestEndpointConfig.class);

TesterWsCloseClient client = new TesterWsCloseClient("localhost", getPort());
Expand Down

0 comments on commit da1ac1b

Please sign in to comment.