@Override public void close(int code, String reason) { session.close(code, reason); }
@Override public void close(final int status, final String reason) { session.close(status, reason); }
@Override public void close(final String reason) throws IOException { session.close(StatusCode.NORMAL, reason); }
@Override public Mono<Void> close(CloseStatus status) { getDelegate().close(status.getCode(), status.getReason()); return Mono.empty(); }
void closeWebSocket() { if (isWebSocketOpen()) { wsSession.close(); } wsSession = null; }
@OnWebSocketClose public void close(int code, String reason) { closed = true; if (!target.closed) { target.closed = true; session.close(code, reason); } }
synchronized void stop() { if (isRunning()) { LOG.debug("close {}", sessionName()); session.close(); session = null; sessionName = "[No Session]"; } }
@Override protected void closeInternal(CloseStatus status) throws IOException { getNativeSession().close(status.getCode(), status.getReason()); }
@Signature public void close(int statusCode, String reason) { getWrappedObject().close(statusCode, reason); }
@OnWebSocketConnect public void onConnect(final Session session) { session.close(); latch.countDown(); }
@Override public void onWebSocketClose(int statusCode, String reason) { getSession().close(); super.onWebSocketClose(statusCode, reason); }
@Test public void shouldSetSessionToNullWhenStopped() throws Exception { when(session.isOpen()).thenReturn(true); when(session.getRemoteAddress()).thenReturn(null); handler.stop(); verify(session).close(); assertThat(handler.isNotRunning(), is(true)); }
@Override public void onWebSocketText(String message) { if (isNotConnected()) { return; } if (message.equals("CLOSE")) { getSession().close(); return; } try { LOGGER.debug("Received text frame of size: {}", message); getRemote().sendString(message); } catch (IOException e) { e.printStackTrace(); } } }
@OnWebSocketConnect public void onConnect(Session session) throws IOException { System.out.printf("Got connect: %s%n", session); LOG.info("Got connect: %s%n", session); // Trivial MQTT Connect message // assertEquals(12, out.readByte()); //remaining length // verifyString("MQIsdp", out); // assertEquals(0x03, out.readByte()); //protocol version // assertEquals(0x32, out.readByte()); //flags // assertEquals(2, out.readByte()); //keepAliveTimer msb // assertEquals(0, out.readByte()); //keepAliveTimer lsb ByteBuffer msg = ByteBuffer.wrap(new byte[]{0x10, // message type 0x0C, // remaining lenght 12 bytes 'M', 'Q', 'I', 's', 'd', 'p', 0x03, // protocol version 0x32, // flags 0x02, 0x00// keepAlive Timer, 2 seconds }); // try { session.getRemote().sendBytes(msg); this.connectSentLatch.countDown(); session.close(StatusCode.NORMAL, "I'm done"); // } catch (IOException t) { // LOG.error(null, t); // } }
public void close() { session.close(); }
@Override public void close(int code, String reason) { if (isOpen()) { session.close(code, reason); } }
/** * {@inheritDoc} */ @Override protected void close() { synchronized (webSocketSyncRoot) { if (webSocket != null) { // 410 Gone indicates that the resource requested is no longer // available and will not be available again. webSocket.getSession().close(410, "replaced"); webSocket = null; if (logger.isDebugEnabled()) { logger.debug( "Endpoint expired, closed colibri web-socket."); } } } }
/** * Notifies this {@link EndpointMessageTransport} that a specific * {@link ColibriWebSocket} instance associated with its {@link Endpoint} * has connected. * @param ws the {@link ColibriWebSocket} which has connected. */ void onWebSocketConnect(ColibriWebSocket ws) { synchronized (webSocketSyncRoot) { // If we already have a web-socket, discard it and use the new one. if (webSocket != null) { webSocket.getSession().close(200, "replaced"); } webSocket = ws; webSocketLastActive = true; sendMessage(ws, createServerHelloEvent(), "initial ServerHello"); } notifyTransportChannelConnected(); }
@Override public void close( final int code, final String reason ) { this.raw.close( code, reason ); }
public void close() { if (connection != null) { connection.close(); } }