Skip to content

Commit

Permalink
Changed ws.closeWithReason() name to ws.close()
Browse files Browse the repository at this point in the history
Signed-off-by: francesco <francescoguard@gmail.com>
  • Loading branch information
slinkydeveloper committed Jan 17, 2018
1 parent b1d8c6f commit 33e4c26
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/vertx/core/http/WebSocketBase.java
Expand Up @@ -246,7 +246,7 @@ public interface WebSocketBase extends ReadStream<Buffer>, WriteStream<Buffer> {
* @param statusCode Status code
* @param reason reason of closure
*/
void closeWithReason(short statusCode, @Nullable String reason);
void close(short statusCode, @Nullable String reason);

/**
* @return the remote address for this socket
Expand Down
Expand Up @@ -98,7 +98,7 @@ public void close() {
}
}

public void closeWithReason(short statusCode, String reason) {
public void close(short statusCode, String reason) {
synchronized (conn) {
checkClosed();
conn.closeWithPayload(WebSocketCloseFrameCode.generateByteBuffer(statusCode, reason));
Expand Down
7 changes: 2 additions & 5 deletions src/test/java/io/vertx/test/core/WebsocketTest.java
Expand Up @@ -12,8 +12,6 @@
package io.vertx.test.core;


import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.http.websocketx.WebSocketHandshakeException;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.AsyncResult;
Expand Down Expand Up @@ -48,7 +46,6 @@
import io.vertx.core.streams.ReadStream;
import io.vertx.test.core.tls.Cert;
import io.vertx.test.core.tls.Trust;
import org.junit.Ignore;
import org.junit.Test;

import javax.security.cert.X509Certificate;
Expand Down Expand Up @@ -2142,7 +2139,7 @@ public void testCloseCustomPayloadFromServer() throws InterruptedException {
socket.closeHandler(a -> {
latch.countDown();
});
vertx.setTimer(1000, (ar) -> socket.closeWithReason(STATUS_CODE, REASON));
vertx.setTimer(1000, (ar) -> socket.close(STATUS_CODE, REASON));
})
.listen(ar -> {
client.websocket(HttpTestBase.DEFAULT_HTTP_PORT, HttpTestBase.DEFAULT_HTTP_HOST, "/", ws -> {
Expand Down Expand Up @@ -2176,7 +2173,7 @@ public void testCloseCustomPayloadFromClient() throws InterruptedException {
})
.listen(ar -> {
client.websocket(HttpTestBase.DEFAULT_HTTP_PORT, HttpTestBase.DEFAULT_HTTP_HOST, "/", ws -> {
ws.closeWithReason(STATUS_CODE, REASON);
ws.close(STATUS_CODE, REASON);
});
});
awaitLatch(latch);
Expand Down

0 comments on commit 33e4c26

Please sign in to comment.