Fixes #2234 - Making assertion on reason phrase more resilient to race condition for Abnormal closure.

This commit is contained in:
Joakim Erdfelt 2018-02-26 13:26:03 -06:00
parent edf83aab10
commit 6fa855e856
1 changed files with 14 additions and 9 deletions

View File

@ -18,6 +18,15 @@
package org.eclipse.jetty.websocket.client;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.SocketTimeoutException;
@ -70,14 +79,6 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
public class ClientCloseTest
{
private static final Logger LOG = Log.getLogger(ClientCloseTest.class);
@ -490,7 +491,11 @@ public class ClientCloseTest
// client reads -1 (EOF)
// client triggers close event on client ws-endpoint
clientSocket.assertReceivedCloseEvent(timeout,is(StatusCode.ABNORMAL),containsString("EOF"));
clientSocket.assertReceivedCloseEvent(timeout,is(StatusCode.ABNORMAL),
anyOf(
containsString("EOF"),
containsString("Disconnected")
));
}
@Test