mirror of
https://github.com/jetty/jetty.project.git
synced 2025-02-28 19:09:10 +00:00
JSR-356 - Refactoring Annotated method parameter detection and use
This commit is contained in:
parent
70a57f223f
commit
d967dafe45
@ -183,6 +183,11 @@ public class JsrSession extends WebSocketSession implements javax.websocket.Sess
|
|||||||
return encoderFactory;
|
return encoderFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EndpointConfig getEndpointConfig()
|
||||||
|
{
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
public EndpointMetadata getEndpointMetadata()
|
public EndpointMetadata getEndpointMetadata()
|
||||||
{
|
{
|
||||||
return metadata;
|
return metadata;
|
||||||
|
@ -35,6 +35,7 @@ public abstract class JsrCallable extends CallableMethod
|
|||||||
protected final Param[] params;
|
protected final Param[] params;
|
||||||
protected final Object[] args;
|
protected final Object[] args;
|
||||||
protected int idxSession = -1;
|
protected int idxSession = -1;
|
||||||
|
protected int idxConfig = -1;
|
||||||
|
|
||||||
public JsrCallable(Class<?> pojo, Method method)
|
public JsrCallable(Class<?> pojo, Method method)
|
||||||
{
|
{
|
||||||
@ -59,6 +60,7 @@ public abstract class JsrCallable extends CallableMethod
|
|||||||
{
|
{
|
||||||
this(copy.getPojo(),copy.getMethod());
|
this(copy.getPojo(),copy.getMethod());
|
||||||
this.idxSession = copy.idxSession;
|
this.idxSession = copy.idxSession;
|
||||||
|
this.idxConfig = copy.idxConfig;
|
||||||
System.arraycopy(copy.params,0,this.params,0,params.length);
|
System.arraycopy(copy.params,0,this.params,0,params.length);
|
||||||
System.arraycopy(copy.args,0,this.args,0,args.length);
|
System.arraycopy(copy.args,0,this.args,0,args.length);
|
||||||
}
|
}
|
||||||
@ -114,6 +116,13 @@ public abstract class JsrCallable extends CallableMethod
|
|||||||
args[idxSession] = session;
|
args[idxSession] = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Optional EndpointConfig
|
||||||
|
idxConfig = findIndexForRole(Param.Role.ENDPOINT_CONFIG);
|
||||||
|
if (idxConfig >= 0)
|
||||||
|
{
|
||||||
|
args[idxConfig] = session.getEndpointConfig();
|
||||||
|
}
|
||||||
|
|
||||||
// Default for the path parameters
|
// Default for the path parameters
|
||||||
// PathParam's are optional parameters (always)
|
// PathParam's are optional parameters (always)
|
||||||
Map<String, String> pathParams = session.getPathParameters();
|
Map<String, String> pathParams = session.getPathParameters();
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
//
|
||||||
|
// ========================================================================
|
||||||
|
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// All rights reserved. This program and the accompanying materials
|
||||||
|
// are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
// and Apache License v2.0 which accompanies this distribution.
|
||||||
|
//
|
||||||
|
// The Eclipse Public License is available at
|
||||||
|
// http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
//
|
||||||
|
// The Apache License v2.0 is available at
|
||||||
|
// http://www.opensource.org/licenses/apache2.0.php
|
||||||
|
//
|
||||||
|
// You may elect to redistribute this code under either of these licenses.
|
||||||
|
// ========================================================================
|
||||||
|
//
|
||||||
|
|
||||||
|
package org.eclipse.jetty.websocket.jsr356.annotations;
|
||||||
|
|
||||||
|
import javax.websocket.EndpointConfig;
|
||||||
|
import javax.websocket.Session;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common base for Parameter Identification in JSR Callable methods
|
||||||
|
*/
|
||||||
|
public abstract class JsrParamIdBase implements IJsrParamId
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
||||||
|
{
|
||||||
|
// Session parameter (optional)
|
||||||
|
if (param.type.isAssignableFrom(Session.class))
|
||||||
|
{
|
||||||
|
param.bind(Role.SESSION);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Endpoint Config (optional)
|
||||||
|
if (param.type.isAssignableFrom(EndpointConfig.class))
|
||||||
|
{
|
||||||
|
param.bind(Role.ENDPOINT_CONFIG);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -22,7 +22,6 @@ import java.io.InputStream;
|
|||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
import javax.websocket.OnMessage;
|
import javax.websocket.OnMessage;
|
||||||
import javax.websocket.Session;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
||||||
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
||||||
@ -39,10 +38,9 @@ public class JsrParamIdBinary extends JsrParamIdOnMessage implements IJsrParamId
|
|||||||
@Override
|
@Override
|
||||||
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
||||||
{
|
{
|
||||||
// Session parameter (optional)
|
if (super.process(param,callable))
|
||||||
if (param.type.isAssignableFrom(Session.class))
|
|
||||||
{
|
{
|
||||||
param.bind(Role.SESSION);
|
// Found common roles
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ package org.eclipse.jetty.websocket.jsr356.annotations;
|
|||||||
|
|
||||||
import javax.websocket.CloseReason;
|
import javax.websocket.CloseReason;
|
||||||
import javax.websocket.OnClose;
|
import javax.websocket.OnClose;
|
||||||
import javax.websocket.Session;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
||||||
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
||||||
@ -28,16 +27,16 @@ import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
|||||||
/**
|
/**
|
||||||
* Param handling for @{@link OnClose} parameters.
|
* Param handling for @{@link OnClose} parameters.
|
||||||
*/
|
*/
|
||||||
public class JsrParamIdOnClose implements IJsrParamId
|
public class JsrParamIdOnClose extends JsrParamIdBase implements IJsrParamId
|
||||||
{
|
{
|
||||||
public static final IJsrParamId INSTANCE = new JsrParamIdOnClose();
|
public static final IJsrParamId INSTANCE = new JsrParamIdOnClose();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
||||||
{
|
{
|
||||||
if (param.type.isAssignableFrom(Session.class))
|
if (super.process(param,callable))
|
||||||
{
|
{
|
||||||
param.bind(Role.SESSION);
|
// Found common roles
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
package org.eclipse.jetty.websocket.jsr356.annotations;
|
package org.eclipse.jetty.websocket.jsr356.annotations;
|
||||||
|
|
||||||
import javax.websocket.OnError;
|
import javax.websocket.OnError;
|
||||||
import javax.websocket.Session;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
||||||
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
||||||
@ -27,16 +26,16 @@ import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
|||||||
/**
|
/**
|
||||||
* Param handling for @{@link OnError} parameters.
|
* Param handling for @{@link OnError} parameters.
|
||||||
*/
|
*/
|
||||||
public class JsrParamIdOnError implements IJsrParamId
|
public class JsrParamIdOnError extends JsrParamIdBase implements IJsrParamId
|
||||||
{
|
{
|
||||||
public static final IJsrParamId INSTANCE = new JsrParamIdOnError();
|
public static final IJsrParamId INSTANCE = new JsrParamIdOnError();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
||||||
{
|
{
|
||||||
if (param.type.isAssignableFrom(Session.class))
|
if (super.process(param,callable))
|
||||||
{
|
{
|
||||||
param.bind(Role.SESSION);
|
// Found common roles
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ package org.eclipse.jetty.websocket.jsr356.annotations;
|
|||||||
|
|
||||||
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
||||||
|
|
||||||
public abstract class JsrParamIdOnMessage implements IJsrParamId
|
public abstract class JsrParamIdOnMessage extends JsrParamIdBase implements IJsrParamId
|
||||||
{
|
{
|
||||||
protected void assertPartialMessageSupportDisabled(Param param, JsrCallable callable)
|
protected void assertPartialMessageSupportDisabled(Param param, JsrCallable callable)
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,6 @@ package org.eclipse.jetty.websocket.jsr356.annotations;
|
|||||||
|
|
||||||
import javax.websocket.EndpointConfig;
|
import javax.websocket.EndpointConfig;
|
||||||
import javax.websocket.OnOpen;
|
import javax.websocket.OnOpen;
|
||||||
import javax.websocket.Session;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
||||||
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
||||||
@ -28,16 +27,16 @@ import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
|||||||
/**
|
/**
|
||||||
* Param handling for @{@link OnOpen} parameters.
|
* Param handling for @{@link OnOpen} parameters.
|
||||||
*/
|
*/
|
||||||
public class JsrParamIdOnOpen implements IJsrParamId
|
public class JsrParamIdOnOpen extends JsrParamIdBase implements IJsrParamId
|
||||||
{
|
{
|
||||||
public static final IJsrParamId INSTANCE = new JsrParamIdOnOpen();
|
public static final IJsrParamId INSTANCE = new JsrParamIdOnOpen();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
||||||
{
|
{
|
||||||
if (param.type.isAssignableFrom(Session.class))
|
if (super.process(param,callable))
|
||||||
{
|
{
|
||||||
param.bind(Role.SESSION);
|
// Found common roles
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
package org.eclipse.jetty.websocket.jsr356.annotations;
|
package org.eclipse.jetty.websocket.jsr356.annotations;
|
||||||
|
|
||||||
import javax.websocket.PongMessage;
|
import javax.websocket.PongMessage;
|
||||||
import javax.websocket.Session;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
||||||
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
||||||
@ -32,10 +31,9 @@ public class JsrParamIdPong extends JsrParamIdOnMessage implements IJsrParamId
|
|||||||
@Override
|
@Override
|
||||||
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
||||||
{
|
{
|
||||||
// Session parameter (optional)
|
if (super.process(param,callable))
|
||||||
if (param.type.isAssignableFrom(Session.class))
|
|
||||||
{
|
{
|
||||||
param.bind(Role.SESSION);
|
// Found common roles
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ package org.eclipse.jetty.websocket.jsr356.annotations;
|
|||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
|
||||||
import javax.websocket.OnMessage;
|
import javax.websocket.OnMessage;
|
||||||
import javax.websocket.Session;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
|
||||||
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
import org.eclipse.jetty.websocket.jsr356.annotations.Param.Role;
|
||||||
@ -56,10 +55,9 @@ public class JsrParamIdText extends JsrParamIdOnMessage implements IJsrParamId
|
|||||||
@Override
|
@Override
|
||||||
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
public boolean process(Param param, JsrCallable callable) throws InvalidSignatureException
|
||||||
{
|
{
|
||||||
// Session parameter (optional)
|
if (super.process(param,callable))
|
||||||
if (param.type.isAssignableFrom(Session.class))
|
|
||||||
{
|
{
|
||||||
param.bind(Role.SESSION);
|
// Found common roles
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,17 @@ public class OnCloseCallable extends JsrCallable
|
|||||||
this.call(endpoint,close.getStatusCode(),close.getReason());
|
this.call(endpoint,close.getStatusCode(),close.getReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void call(Object endpoint, CloseReason closeReason)
|
||||||
|
{
|
||||||
|
// Close Reason is an optional parameter
|
||||||
|
if (idxCloseReason >= 0)
|
||||||
|
{
|
||||||
|
// convert to javax.websocket.CloseReason
|
||||||
|
super.args[idxCloseReason] = closeReason;
|
||||||
|
}
|
||||||
|
super.call(endpoint,super.args);
|
||||||
|
}
|
||||||
|
|
||||||
public void call(Object endpoint, int statusCode, String reason)
|
public void call(Object endpoint, int statusCode, String reason)
|
||||||
{
|
{
|
||||||
// Close Reason is an optional parameter
|
// Close Reason is an optional parameter
|
||||||
|
@ -1,77 +0,0 @@
|
|||||||
//
|
|
||||||
// ========================================================================
|
|
||||||
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
// All rights reserved. This program and the accompanying materials
|
|
||||||
// are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
// and Apache License v2.0 which accompanies this distribution.
|
|
||||||
//
|
|
||||||
// The Eclipse Public License is available at
|
|
||||||
// http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
//
|
|
||||||
// The Apache License v2.0 is available at
|
|
||||||
// http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
//
|
|
||||||
// You may elect to redistribute this code under either of these licenses.
|
|
||||||
// ========================================================================
|
|
||||||
//
|
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.jsr356.endpoints;
|
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
|
||||||
|
|
||||||
import javax.websocket.CloseReason;
|
|
||||||
import javax.websocket.DeploymentException;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.common.events.annotated.CallableMethod;
|
|
||||||
import org.eclipse.jetty.websocket.jsr356.ClientContainer;
|
|
||||||
import org.eclipse.jetty.websocket.jsr356.annotations.AnnotatedEndpointScanner;
|
|
||||||
import org.eclipse.jetty.websocket.jsr356.client.AnnotatedClientEndpointMetadata;
|
|
||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicOpenCloseSessionSocket;
|
|
||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicOpenCloseSocket;
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class ClientAnnotatedEndpointScannerTest
|
|
||||||
{
|
|
||||||
private static ClientContainer container = new ClientContainer();
|
|
||||||
|
|
||||||
private void assertHasCallable(String msg, CallableMethod callable, Class<?>... expectedParameters)
|
|
||||||
{
|
|
||||||
Assert.assertThat(msg,callable,notNullValue());
|
|
||||||
int len = expectedParameters.length;
|
|
||||||
for (int i = 0; i < len; i++)
|
|
||||||
{
|
|
||||||
Class<?> expectedParam = expectedParameters[i];
|
|
||||||
Class<?> actualParam = callable.getParamTypes()[i];
|
|
||||||
|
|
||||||
Assert.assertTrue("Parameter[" + i + "] - expected:[" + expectedParam + "], actual:[" + actualParam + "]",actualParam.equals(expectedParam));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testScan_BasicOpenClose() throws DeploymentException
|
|
||||||
{
|
|
||||||
AnnotatedClientEndpointMetadata metadata = new AnnotatedClientEndpointMetadata(container,BasicOpenCloseSocket.class);
|
|
||||||
AnnotatedEndpointScanner scanner = new AnnotatedEndpointScanner(metadata);
|
|
||||||
scanner.scan();
|
|
||||||
|
|
||||||
Assert.assertThat("Metadata",metadata,notNullValue());
|
|
||||||
|
|
||||||
assertHasCallable("Metadata.onOpen",metadata.onOpen);
|
|
||||||
assertHasCallable("Metadata.onClose",metadata.onClose,CloseReason.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testScan_BasicSessionOpenClose() throws DeploymentException
|
|
||||||
{
|
|
||||||
AnnotatedClientEndpointMetadata metadata = new AnnotatedClientEndpointMetadata(container,BasicOpenCloseSessionSocket.class);
|
|
||||||
AnnotatedEndpointScanner scanner = new AnnotatedEndpointScanner(metadata);
|
|
||||||
scanner.scan();
|
|
||||||
|
|
||||||
Assert.assertThat("Metadata",metadata,notNullValue());
|
|
||||||
|
|
||||||
assertHasCallable("Metadata.onOpen",metadata.onOpen);
|
|
||||||
assertHasCallable("Metadata.onClose",metadata.onClose,CloseReason.class);
|
|
||||||
}
|
|
||||||
}
|
|
@ -26,20 +26,18 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.websocket.ClientEndpoint;
|
||||||
|
import javax.websocket.ClientEndpointConfig;
|
||||||
import javax.websocket.CloseReason;
|
import javax.websocket.CloseReason;
|
||||||
import javax.websocket.PongMessage;
|
import javax.websocket.PongMessage;
|
||||||
import javax.websocket.Session;
|
import javax.websocket.Session;
|
||||||
|
|
||||||
import org.eclipse.jetty.websocket.jsr356.ClientContainer;
|
import org.eclipse.jetty.websocket.jsr356.ClientContainer;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.annotations.AnnotatedEndpointMetadata;
|
||||||
import org.eclipse.jetty.websocket.jsr356.annotations.AnnotatedEndpointScanner;
|
import org.eclipse.jetty.websocket.jsr356.annotations.AnnotatedEndpointScanner;
|
||||||
import org.eclipse.jetty.websocket.jsr356.annotations.JsrCallable;
|
import org.eclipse.jetty.websocket.jsr356.annotations.JsrCallable;
|
||||||
import org.eclipse.jetty.websocket.jsr356.annotations.AnnotatedEndpointMetadata;
|
|
||||||
import org.eclipse.jetty.websocket.jsr356.client.AnnotatedClientEndpointMetadata;
|
import org.eclipse.jetty.websocket.jsr356.client.AnnotatedClientEndpointMetadata;
|
||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicBinaryMessageByteBufferSocket;
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicBinaryMessageByteBufferSocket;
|
||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicCloseReasonSessionSocket;
|
|
||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicCloseReasonSocket;
|
|
||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicCloseSessionReasonSocket;
|
|
||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicCloseSocket;
|
|
||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicErrorSessionSocket;
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicErrorSessionSocket;
|
||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicErrorSessionThrowableSocket;
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicErrorSessionThrowableSocket;
|
||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicErrorSocket;
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicErrorSocket;
|
||||||
@ -49,6 +47,10 @@ import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicOpenSessionSock
|
|||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicOpenSocket;
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicOpenSocket;
|
||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicPongMessageSocket;
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicPongMessageSocket;
|
||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicTextMessageStringSocket;
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicTextMessageStringSocket;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.close.CloseReasonSessionSocket;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.close.CloseReasonSocket;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.close.CloseSessionReasonSocket;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.close.CloseSocket;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@ -102,10 +104,10 @@ public class ClientAnnotatedEndpointScanner_GoodSignaturesTest
|
|||||||
Case.add(data, BasicOpenSocket.class, fOpen);
|
Case.add(data, BasicOpenSocket.class, fOpen);
|
||||||
Case.add(data, BasicOpenSessionSocket.class, fOpen, Session.class);
|
Case.add(data, BasicOpenSessionSocket.class, fOpen, Session.class);
|
||||||
// -- Close Events
|
// -- Close Events
|
||||||
Case.add(data, BasicCloseSocket.class, fClose);
|
Case.add(data, CloseSocket.class, fClose);
|
||||||
Case.add(data, BasicCloseReasonSocket.class, fClose, CloseReason.class);
|
Case.add(data, CloseReasonSocket.class, fClose, CloseReason.class);
|
||||||
Case.add(data, BasicCloseReasonSessionSocket.class, fClose, CloseReason.class, Session.class);
|
Case.add(data, CloseReasonSessionSocket.class, fClose, CloseReason.class, Session.class);
|
||||||
Case.add(data, BasicCloseSessionReasonSocket.class, fClose, Session.class, CloseReason.class);
|
Case.add(data, CloseSessionReasonSocket.class, fClose, Session.class, CloseReason.class);
|
||||||
// -- Error Events
|
// -- Error Events
|
||||||
Case.add(data, BasicErrorSocket.class, fError);
|
Case.add(data, BasicErrorSocket.class, fError);
|
||||||
Case.add(data, BasicErrorSessionSocket.class, fError, Session.class);
|
Case.add(data, BasicErrorSessionSocket.class, fError, Session.class);
|
||||||
@ -141,7 +143,7 @@ public class ClientAnnotatedEndpointScanner_GoodSignaturesTest
|
|||||||
public void testScan_Basic() throws Exception
|
public void testScan_Basic() throws Exception
|
||||||
{
|
{
|
||||||
AnnotatedClientEndpointMetadata metadata = new AnnotatedClientEndpointMetadata(container,testcase.pojo);
|
AnnotatedClientEndpointMetadata metadata = new AnnotatedClientEndpointMetadata(container,testcase.pojo);
|
||||||
AnnotatedEndpointScanner scanner = new AnnotatedEndpointScanner(metadata);
|
AnnotatedEndpointScanner<ClientEndpoint, ClientEndpointConfig> scanner = new AnnotatedEndpointScanner<>(metadata);
|
||||||
scanner.scan();
|
scanner.scan();
|
||||||
|
|
||||||
Assert.assertThat("Metadata",metadata,notNullValue());
|
Assert.assertThat("Metadata",metadata,notNullValue());
|
||||||
|
@ -25,6 +25,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.websocket.ClientEndpoint;
|
||||||
|
import javax.websocket.ClientEndpointConfig;
|
||||||
import javax.websocket.DeploymentException;
|
import javax.websocket.DeploymentException;
|
||||||
import javax.websocket.OnClose;
|
import javax.websocket.OnClose;
|
||||||
import javax.websocket.OnError;
|
import javax.websocket.OnError;
|
||||||
@ -96,7 +98,7 @@ public class ClientAnnotatedEndpointScanner_InvalidSignaturesTest
|
|||||||
public void testScan_InvalidSignature() throws DeploymentException
|
public void testScan_InvalidSignature() throws DeploymentException
|
||||||
{
|
{
|
||||||
AnnotatedClientEndpointMetadata metadata = new AnnotatedClientEndpointMetadata(container,pojo);
|
AnnotatedClientEndpointMetadata metadata = new AnnotatedClientEndpointMetadata(container,pojo);
|
||||||
AnnotatedEndpointScanner scanner = new AnnotatedEndpointScanner(metadata);
|
AnnotatedEndpointScanner<ClientEndpoint, ClientEndpointConfig> scanner = new AnnotatedEndpointScanner<>(metadata);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
scanner.scan();
|
scanner.scan();
|
||||||
|
@ -0,0 +1,126 @@
|
|||||||
|
//
|
||||||
|
// ========================================================================
|
||||||
|
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// All rights reserved. This program and the accompanying materials
|
||||||
|
// are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
// and Apache License v2.0 which accompanies this distribution.
|
||||||
|
//
|
||||||
|
// The Eclipse Public License is available at
|
||||||
|
// http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
//
|
||||||
|
// The Apache License v2.0 is available at
|
||||||
|
// http://www.opensource.org/licenses/apache2.0.php
|
||||||
|
//
|
||||||
|
// You may elect to redistribute this code under either of these licenses.
|
||||||
|
// ========================================================================
|
||||||
|
//
|
||||||
|
|
||||||
|
package org.eclipse.jetty.websocket.jsr356.endpoints;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.websocket.ClientEndpoint;
|
||||||
|
import javax.websocket.ClientEndpointConfig;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.toolchain.test.EventQueue;
|
||||||
|
import org.eclipse.jetty.websocket.api.StatusCode;
|
||||||
|
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
|
||||||
|
import org.eclipse.jetty.websocket.common.CloseInfo;
|
||||||
|
import org.eclipse.jetty.websocket.common.events.EventDriver;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.ClientContainer;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.annotations.AnnotatedEndpointScanner;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.annotations.JsrEvents;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.client.AnnotatedClientEndpointMetadata;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.close.CloseEndpointConfigSocket;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.close.CloseReasonSessionSocket;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.close.CloseReasonSocket;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.close.CloseSessionReasonSocket;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.close.CloseSessionSocket;
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.close.CloseSocket;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.Parameterized;
|
||||||
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
|
|
||||||
|
@RunWith(Parameterized.class)
|
||||||
|
public class OnCloseTest
|
||||||
|
{
|
||||||
|
private static class Case
|
||||||
|
{
|
||||||
|
public static Case add(List<Case[]> data, Class<?> closeClass)
|
||||||
|
{
|
||||||
|
Case tcase = new Case();
|
||||||
|
tcase.closeClass = closeClass;
|
||||||
|
data.add(new Case[]
|
||||||
|
{ tcase });
|
||||||
|
return tcase;
|
||||||
|
}
|
||||||
|
|
||||||
|
Class<?> closeClass;
|
||||||
|
String expectedCloseEvent;
|
||||||
|
|
||||||
|
public Case expect(String expectedEvent)
|
||||||
|
{
|
||||||
|
this.expectedCloseEvent = expectedEvent;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ClientContainer container = new ClientContainer();
|
||||||
|
|
||||||
|
@Parameters
|
||||||
|
public static Collection<Case[]> data() throws Exception
|
||||||
|
{
|
||||||
|
List<Case[]> data = new ArrayList<>();
|
||||||
|
|
||||||
|
Case.add(data,CloseSocket.class).expect("onClose()");
|
||||||
|
Case.add(data,CloseReasonSocket.class).expect("onClose(CloseReason)");
|
||||||
|
Case.add(data,CloseSessionSocket.class).expect("onClose(Session)");
|
||||||
|
Case.add(data,CloseReasonSessionSocket.class).expect("onClose(CloseReason,Session)");
|
||||||
|
Case.add(data,CloseSessionReasonSocket.class).expect("onClose(Session,CloseReason)");
|
||||||
|
Case.add(data,CloseEndpointConfigSocket.class).expect("onClose(EndpointConfig)");
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Case testcase;
|
||||||
|
|
||||||
|
public OnCloseTest(Case testcase)
|
||||||
|
{
|
||||||
|
this.testcase = testcase;
|
||||||
|
System.err.printf("Testing @OnClose for %s%n",testcase.closeClass.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOnCloseCall() throws Exception
|
||||||
|
{
|
||||||
|
// Scan annotations
|
||||||
|
AnnotatedClientEndpointMetadata metadata = new AnnotatedClientEndpointMetadata(container,testcase.closeClass);
|
||||||
|
AnnotatedEndpointScanner<ClientEndpoint, ClientEndpointConfig> scanner = new AnnotatedEndpointScanner<>(metadata);
|
||||||
|
scanner.scan();
|
||||||
|
|
||||||
|
// Build up EventDriver
|
||||||
|
WebSocketPolicy policy = WebSocketPolicy.newClientPolicy();
|
||||||
|
ClientEndpointConfig config = metadata.getConfig();
|
||||||
|
TrackingSocket endpoint = (TrackingSocket)testcase.closeClass.newInstance();
|
||||||
|
EndpointInstance ei = new EndpointInstance(endpoint,config,metadata);
|
||||||
|
JsrEvents<ClientEndpoint, ClientEndpointConfig> jsrevents = new JsrEvents<>(metadata);
|
||||||
|
|
||||||
|
EventDriver driver = new JsrAnnotatedEventDriver(policy,ei,jsrevents);
|
||||||
|
|
||||||
|
// Execute onClose call
|
||||||
|
driver.onClose(new CloseInfo(StatusCode.NORMAL,"normal"));
|
||||||
|
|
||||||
|
// Test captured event
|
||||||
|
EventQueue<String> events = endpoint.eventQueue;
|
||||||
|
Assert.assertThat("Number of Events Captured",events.size(),is(1));
|
||||||
|
String closeEvent = events.poll();
|
||||||
|
Assert.assertThat("Close Event",closeEvent,is(testcase.expectedCloseEvent));
|
||||||
|
}
|
||||||
|
}
|
@ -20,14 +20,13 @@ package org.eclipse.jetty.websocket.jsr356.endpoints;
|
|||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
|
|
||||||
import java.util.concurrent.BlockingQueue;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.websocket.CloseReason;
|
import javax.websocket.CloseReason;
|
||||||
import javax.websocket.CloseReason.CloseCode;
|
import javax.websocket.CloseReason.CloseCode;
|
||||||
|
|
||||||
import org.eclipse.jetty.util.BlockingArrayQueue;
|
import org.eclipse.jetty.toolchain.test.EventQueue;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
@ -38,14 +37,25 @@ import org.junit.Assert;
|
|||||||
public abstract class TrackingSocket
|
public abstract class TrackingSocket
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(TrackingSocket.class);
|
private static final Logger LOG = Log.getLogger(TrackingSocket.class);
|
||||||
|
|
||||||
public CloseReason closeReason;
|
public CloseReason closeReason;
|
||||||
public BlockingQueue<String> eventQueue = new BlockingArrayQueue<String>();
|
public EventQueue<String> eventQueue = new EventQueue<String>();
|
||||||
public BlockingQueue<Throwable> errorQueue = new BlockingArrayQueue<>();
|
public EventQueue<Throwable> errorQueue = new EventQueue<>();
|
||||||
public CountDownLatch openLatch = new CountDownLatch(1);
|
public CountDownLatch openLatch = new CountDownLatch(1);
|
||||||
public CountDownLatch closeLatch = new CountDownLatch(1);
|
public CountDownLatch closeLatch = new CountDownLatch(1);
|
||||||
public CountDownLatch dataLatch = new CountDownLatch(1);
|
public CountDownLatch dataLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
|
protected void addError(Throwable t)
|
||||||
|
{
|
||||||
|
LOG.warn(t);
|
||||||
|
errorQueue.add(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addEvent(String format, Object... args)
|
||||||
|
{
|
||||||
|
eventQueue.add(String.format(format,args));
|
||||||
|
}
|
||||||
|
|
||||||
public void assertClose(CloseCode expectedCode, String expectedReason) throws InterruptedException
|
public void assertClose(CloseCode expectedCode, String expectedReason) throws InterruptedException
|
||||||
{
|
{
|
||||||
assertCloseCode(expectedCode);
|
assertCloseCode(expectedCode);
|
||||||
@ -64,14 +74,10 @@ public abstract class TrackingSocket
|
|||||||
Assert.assertThat("Close Reason",closeReason.getReasonPhrase(),is(expectedReason));
|
Assert.assertThat("Close Reason",closeReason.getReasonPhrase(),is(expectedReason));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addEvent(String format, Object... args)
|
public void assertEvent(String expected)
|
||||||
{
|
{
|
||||||
eventQueue.add(String.format(format,args));
|
String actual = eventQueue.poll();
|
||||||
}
|
Assert.assertEquals("Event",expected,actual);
|
||||||
|
|
||||||
protected void addError(Throwable t)
|
|
||||||
{
|
|
||||||
errorQueue.add(t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assertIsOpen() throws InterruptedException
|
public void assertIsOpen() throws InterruptedException
|
||||||
@ -80,12 +86,6 @@ public abstract class TrackingSocket
|
|||||||
assertNotClosed();
|
assertNotClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assertEvent(String expected)
|
|
||||||
{
|
|
||||||
String actual = eventQueue.poll();
|
|
||||||
Assert.assertEquals("Event",expected,actual);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void assertNotClosed()
|
public void assertNotClosed()
|
||||||
{
|
{
|
||||||
Assert.assertThat("Closed Latch",closeLatch.getCount(),greaterThanOrEqualTo(1L));
|
Assert.assertThat("Closed Latch",closeLatch.getCount(),greaterThanOrEqualTo(1L));
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// ========================================================================
|
||||||
|
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// All rights reserved. This program and the accompanying materials
|
||||||
|
// are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
// and Apache License v2.0 which accompanies this distribution.
|
||||||
|
//
|
||||||
|
// The Eclipse Public License is available at
|
||||||
|
// http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
//
|
||||||
|
// The Apache License v2.0 is available at
|
||||||
|
// http://www.opensource.org/licenses/apache2.0.php
|
||||||
|
//
|
||||||
|
// You may elect to redistribute this code under either of these licenses.
|
||||||
|
// ========================================================================
|
||||||
|
//
|
||||||
|
|
||||||
|
package org.eclipse.jetty.websocket.jsr356.endpoints.samples.close;
|
||||||
|
|
||||||
|
import javax.websocket.ClientEndpoint;
|
||||||
|
import javax.websocket.EndpointConfig;
|
||||||
|
import javax.websocket.OnClose;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||||
|
|
||||||
|
@ClientEndpoint
|
||||||
|
public class CloseEndpointConfigSocket extends TrackingSocket
|
||||||
|
{
|
||||||
|
@OnClose
|
||||||
|
public void onClose(EndpointConfig config)
|
||||||
|
{
|
||||||
|
addEvent("onClose(EndpointConfig)");
|
||||||
|
closeLatch.countDown();
|
||||||
|
}
|
||||||
|
}
|
@ -16,7 +16,7 @@
|
|||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
package org.eclipse.jetty.websocket.jsr356.endpoints.samples.close;
|
||||||
|
|
||||||
import javax.websocket.ClientEndpoint;
|
import javax.websocket.ClientEndpoint;
|
||||||
import javax.websocket.CloseReason;
|
import javax.websocket.CloseReason;
|
||||||
@ -26,12 +26,12 @@ import javax.websocket.Session;
|
|||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||||
|
|
||||||
@ClientEndpoint
|
@ClientEndpoint
|
||||||
public class BasicCloseReasonSessionSocket extends TrackingSocket
|
public class CloseReasonSessionSocket extends TrackingSocket
|
||||||
{
|
{
|
||||||
@OnClose
|
@OnClose
|
||||||
public void onClose(CloseReason reason, Session session)
|
public void onClose(CloseReason reason, Session session)
|
||||||
{
|
{
|
||||||
addEvent("onClose(%s,%s)",reason,session);
|
addEvent("onClose(CloseReason,Session)");
|
||||||
closeLatch.countDown();
|
closeLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,7 +16,7 @@
|
|||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
package org.eclipse.jetty.websocket.jsr356.endpoints.samples.close;
|
||||||
|
|
||||||
import javax.websocket.ClientEndpoint;
|
import javax.websocket.ClientEndpoint;
|
||||||
import javax.websocket.CloseReason;
|
import javax.websocket.CloseReason;
|
||||||
@ -25,12 +25,12 @@ import javax.websocket.OnClose;
|
|||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||||
|
|
||||||
@ClientEndpoint
|
@ClientEndpoint
|
||||||
public class BasicCloseReasonSocket extends TrackingSocket
|
public class CloseReasonSocket extends TrackingSocket
|
||||||
{
|
{
|
||||||
@OnClose
|
@OnClose
|
||||||
public void onClose(CloseReason reason)
|
public void onClose(CloseReason reason)
|
||||||
{
|
{
|
||||||
addEvent("onClose(%s)", reason);
|
addEvent("onClose(CloseReason)");
|
||||||
closeLatch.countDown();
|
closeLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,7 +16,7 @@
|
|||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
package org.eclipse.jetty.websocket.jsr356.endpoints.samples.close;
|
||||||
|
|
||||||
import javax.websocket.ClientEndpoint;
|
import javax.websocket.ClientEndpoint;
|
||||||
import javax.websocket.CloseReason;
|
import javax.websocket.CloseReason;
|
||||||
@ -26,12 +26,12 @@ import javax.websocket.Session;
|
|||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||||
|
|
||||||
@ClientEndpoint
|
@ClientEndpoint
|
||||||
public class BasicCloseSessionReasonSocket extends TrackingSocket
|
public class CloseSessionReasonSocket extends TrackingSocket
|
||||||
{
|
{
|
||||||
@OnClose
|
@OnClose
|
||||||
public void onClose(Session session, CloseReason reason)
|
public void onClose(Session session, CloseReason reason)
|
||||||
{
|
{
|
||||||
addEvent("onClose(%s,%s)",session,reason);
|
addEvent("onClose(Session,CloseReason)");
|
||||||
closeLatch.countDown();
|
closeLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// ========================================================================
|
||||||
|
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// All rights reserved. This program and the accompanying materials
|
||||||
|
// are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
// and Apache License v2.0 which accompanies this distribution.
|
||||||
|
//
|
||||||
|
// The Eclipse Public License is available at
|
||||||
|
// http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
//
|
||||||
|
// The Apache License v2.0 is available at
|
||||||
|
// http://www.opensource.org/licenses/apache2.0.php
|
||||||
|
//
|
||||||
|
// You may elect to redistribute this code under either of these licenses.
|
||||||
|
// ========================================================================
|
||||||
|
//
|
||||||
|
|
||||||
|
package org.eclipse.jetty.websocket.jsr356.endpoints.samples.close;
|
||||||
|
|
||||||
|
import javax.websocket.ClientEndpoint;
|
||||||
|
import javax.websocket.OnClose;
|
||||||
|
import javax.websocket.Session;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||||
|
|
||||||
|
@ClientEndpoint
|
||||||
|
public class CloseSessionSocket extends TrackingSocket
|
||||||
|
{
|
||||||
|
@OnClose
|
||||||
|
public void onClose(Session session)
|
||||||
|
{
|
||||||
|
addEvent("onClose(Session)");
|
||||||
|
closeLatch.countDown();
|
||||||
|
}
|
||||||
|
}
|
@ -16,7 +16,7 @@
|
|||||||
// ========================================================================
|
// ========================================================================
|
||||||
//
|
//
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
|
package org.eclipse.jetty.websocket.jsr356.endpoints.samples.close;
|
||||||
|
|
||||||
import javax.websocket.ClientEndpoint;
|
import javax.websocket.ClientEndpoint;
|
||||||
import javax.websocket.OnClose;
|
import javax.websocket.OnClose;
|
||||||
@ -24,7 +24,7 @@ import javax.websocket.OnClose;
|
|||||||
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
|
||||||
|
|
||||||
@ClientEndpoint
|
@ClientEndpoint
|
||||||
public class BasicCloseSocket extends TrackingSocket
|
public class CloseSocket extends TrackingSocket
|
||||||
{
|
{
|
||||||
@OnClose
|
@OnClose
|
||||||
public void onClose()
|
public void onClose()
|
@ -115,6 +115,7 @@ public class ServerAnnotatedEndpointScanner_GoodSignaturesTest
|
|||||||
Field fText = findFieldRef(AnnotatedServerEndpointMetadata.class,"onText");
|
Field fText = findFieldRef(AnnotatedServerEndpointMetadata.class,"onText");
|
||||||
Field fTextStream = findFieldRef(AnnotatedServerEndpointMetadata.class,"onTextStream");
|
Field fTextStream = findFieldRef(AnnotatedServerEndpointMetadata.class,"onTextStream");
|
||||||
Field fBinary = findFieldRef(AnnotatedServerEndpointMetadata.class,"onBinary");
|
Field fBinary = findFieldRef(AnnotatedServerEndpointMetadata.class,"onBinary");
|
||||||
|
@SuppressWarnings("unused")
|
||||||
Field fBinaryStream = findFieldRef(AnnotatedServerEndpointMetadata.class,"onBinaryStream");
|
Field fBinaryStream = findFieldRef(AnnotatedServerEndpointMetadata.class,"onBinaryStream");
|
||||||
Field fPong = findFieldRef(AnnotatedServerEndpointMetadata.class,"onPong");
|
Field fPong = findFieldRef(AnnotatedServerEndpointMetadata.class,"onPong");
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@ import javax.websocket.DeploymentException;
|
|||||||
import javax.websocket.OnClose;
|
import javax.websocket.OnClose;
|
||||||
import javax.websocket.OnError;
|
import javax.websocket.OnError;
|
||||||
import javax.websocket.OnOpen;
|
import javax.websocket.OnOpen;
|
||||||
|
import javax.websocket.server.ServerEndpoint;
|
||||||
|
import javax.websocket.server.ServerEndpointConfig;
|
||||||
|
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
@ -95,7 +97,7 @@ public class ServerAnnotatedEndpointScanner_InvalidSignaturesTest
|
|||||||
public void testScan_InvalidSignature() throws DeploymentException
|
public void testScan_InvalidSignature() throws DeploymentException
|
||||||
{
|
{
|
||||||
AnnotatedServerEndpointMetadata metadata = new AnnotatedServerEndpointMetadata(container,pojo);
|
AnnotatedServerEndpointMetadata metadata = new AnnotatedServerEndpointMetadata(container,pojo);
|
||||||
AnnotatedEndpointScanner scanner = new AnnotatedEndpointScanner(metadata);
|
AnnotatedEndpointScanner<ServerEndpoint,ServerEndpointConfig> scanner = new AnnotatedEndpointScanner<>(metadata);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -45,6 +45,17 @@ public abstract class TrackingSocket
|
|||||||
public CountDownLatch closeLatch = new CountDownLatch(1);
|
public CountDownLatch closeLatch = new CountDownLatch(1);
|
||||||
public CountDownLatch dataLatch = new CountDownLatch(1);
|
public CountDownLatch dataLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
|
protected void addError(Throwable t)
|
||||||
|
{
|
||||||
|
LOG.warn(t);
|
||||||
|
errorQueue.add(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addEvent(String format, Object... args)
|
||||||
|
{
|
||||||
|
eventQueue.add(String.format(format,args));
|
||||||
|
}
|
||||||
|
|
||||||
public void assertClose(CloseCode expectedCode, String expectedReason) throws InterruptedException
|
public void assertClose(CloseCode expectedCode, String expectedReason) throws InterruptedException
|
||||||
{
|
{
|
||||||
assertCloseCode(expectedCode);
|
assertCloseCode(expectedCode);
|
||||||
@ -63,14 +74,10 @@ public abstract class TrackingSocket
|
|||||||
Assert.assertThat("Close Reason",closeReason.getReasonPhrase(),is(expectedReason));
|
Assert.assertThat("Close Reason",closeReason.getReasonPhrase(),is(expectedReason));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addEvent(String format, Object... args)
|
public void assertEvent(String expected)
|
||||||
{
|
{
|
||||||
eventQueue.add(String.format(format,args));
|
String actual = eventQueue.poll();
|
||||||
}
|
Assert.assertEquals("Event",expected,actual);
|
||||||
|
|
||||||
protected void addError(Throwable t)
|
|
||||||
{
|
|
||||||
errorQueue.add(t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assertIsOpen() throws InterruptedException
|
public void assertIsOpen() throws InterruptedException
|
||||||
@ -79,12 +86,6 @@ public abstract class TrackingSocket
|
|||||||
assertNotClosed();
|
assertNotClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assertEvent(String expected)
|
|
||||||
{
|
|
||||||
String actual = eventQueue.poll();
|
|
||||||
Assert.assertEquals("Event",expected,actual);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void assertNotClosed()
|
public void assertNotClosed()
|
||||||
{
|
{
|
||||||
Assert.assertThat("Closed Latch",closeLatch.getCount(),greaterThanOrEqualTo(1L));
|
Assert.assertThat("Closed Latch",closeLatch.getCount(),greaterThanOrEqualTo(1L));
|
||||||
|
@ -23,7 +23,7 @@ import javax.websocket.server.ServerEndpoint;
|
|||||||
|
|
||||||
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
|
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
|
||||||
|
|
||||||
@ServerEndpoint(value="/basic")
|
@ServerEndpoint(value = "/basic")
|
||||||
public class BasicCloseSocket extends TrackingSocket
|
public class BasicCloseSocket extends TrackingSocket
|
||||||
{
|
{
|
||||||
@OnClose
|
@OnClose
|
||||||
|
@ -74,7 +74,7 @@ public class BadNetworkTest
|
|||||||
@Test
|
@Test
|
||||||
public void testAbruptClientClose() throws Exception
|
public void testAbruptClientClose() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
@ -103,7 +103,7 @@ public class BadNetworkTest
|
|||||||
@Test
|
@Test
|
||||||
public void testAbruptServerClose() throws Exception
|
public void testAbruptServerClose() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
|
@ -55,7 +55,7 @@ public class ClientConnectTest
|
|||||||
private WebSocketClient client;
|
private WebSocketClient client;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private <E extends Throwable> E assertExpectedError(ExecutionException e, TrackingSocket wsocket, Class<E> errorClass) throws IOException
|
private <E extends Throwable> E assertExpectedError(ExecutionException e, JettyTrackingSocket wsocket, Class<E> errorClass) throws IOException
|
||||||
{
|
{
|
||||||
// Validate thrown cause
|
// Validate thrown cause
|
||||||
Throwable cause = e.getCause();
|
Throwable cause = e.getCause();
|
||||||
@ -104,7 +104,7 @@ public class ClientConnectTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBadHandshake() throws Exception
|
public void testBadHandshake() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
@ -133,7 +133,7 @@ public class ClientConnectTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBadHandshake_GetOK() throws Exception
|
public void testBadHandshake_GetOK() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
@ -162,7 +162,7 @@ public class ClientConnectTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBadHandshake_GetOK_WithSecWebSocketAccept() throws Exception
|
public void testBadHandshake_GetOK_WithSecWebSocketAccept() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
@ -198,7 +198,7 @@ public class ClientConnectTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBadHandshake_SwitchingProtocols_InvalidConnectionHeader() throws Exception
|
public void testBadHandshake_SwitchingProtocols_InvalidConnectionHeader() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
@ -234,7 +234,7 @@ public class ClientConnectTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBadHandshake_SwitchingProtocols_NoConnectionHeader() throws Exception
|
public void testBadHandshake_SwitchingProtocols_NoConnectionHeader() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
@ -270,7 +270,7 @@ public class ClientConnectTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBadUpgrade() throws Exception
|
public void testBadUpgrade() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
@ -300,7 +300,7 @@ public class ClientConnectTest
|
|||||||
@Ignore("Opened bug 399525")
|
@Ignore("Opened bug 399525")
|
||||||
public void testConnectionNotAccepted() throws Exception
|
public void testConnectionNotAccepted() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
@ -330,7 +330,7 @@ public class ClientConnectTest
|
|||||||
@Test
|
@Test
|
||||||
public void testConnectionRefused() throws Exception
|
public void testConnectionRefused() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
// Intentionally bad port with nothing listening on it
|
// Intentionally bad port with nothing listening on it
|
||||||
URI wsUri = new URI("ws://127.0.0.1:1");
|
URI wsUri = new URI("ws://127.0.0.1:1");
|
||||||
@ -359,7 +359,7 @@ public class ClientConnectTest
|
|||||||
@Test(expected = TimeoutException.class)
|
@Test(expected = TimeoutException.class)
|
||||||
public void testConnectionTimeout_Concurrent() throws Exception
|
public void testConnectionTimeout_Concurrent() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
|
@ -35,9 +35,9 @@ import org.junit.Assert;
|
|||||||
/**
|
/**
|
||||||
* Testing Socket used on client side WebSocket testing.
|
* Testing Socket used on client side WebSocket testing.
|
||||||
*/
|
*/
|
||||||
public class TrackingSocket extends WebSocketAdapter
|
public class JettyTrackingSocket extends WebSocketAdapter
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(TrackingSocket.class);
|
private static final Logger LOG = Log.getLogger(JettyTrackingSocket.class);
|
||||||
|
|
||||||
public int closeCode = -1;
|
public int closeCode = -1;
|
||||||
public Exchanger<String> messageExchanger;
|
public Exchanger<String> messageExchanger;
|
@ -75,7 +75,7 @@ public class SlowClientTest
|
|||||||
@Slow
|
@Slow
|
||||||
public void testClientSlowToSend() throws Exception
|
public void testClientSlowToSend() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket tsocket = new TrackingSocket();
|
JettyTrackingSocket tsocket = new JettyTrackingSocket();
|
||||||
client.getPolicy().setIdleTimeout(60000);
|
client.getPolicy().setIdleTimeout(60000);
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
|
@ -76,7 +76,7 @@ public class SlowServerTest
|
|||||||
@Slow
|
@Slow
|
||||||
public void testServerSlowToRead() throws Exception
|
public void testServerSlowToRead() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket tsocket = new TrackingSocket();
|
JettyTrackingSocket tsocket = new JettyTrackingSocket();
|
||||||
client.setMasker(new ZeroMasker());
|
client.setMasker(new ZeroMasker());
|
||||||
client.getPolicy().setIdleTimeout(60000);
|
client.getPolicy().setIdleTimeout(60000);
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ public class SlowServerTest
|
|||||||
public void testServerSlowToSend() throws Exception
|
public void testServerSlowToSend() throws Exception
|
||||||
{
|
{
|
||||||
// final Exchanger<String> exchanger = new Exchanger<String>();
|
// final Exchanger<String> exchanger = new Exchanger<String>();
|
||||||
TrackingSocket tsocket = new TrackingSocket();
|
JettyTrackingSocket tsocket = new JettyTrackingSocket();
|
||||||
// tsocket.messageExchanger = exchanger;
|
// tsocket.messageExchanger = exchanger;
|
||||||
client.setMasker(new ZeroMasker());
|
client.setMasker(new ZeroMasker());
|
||||||
client.getPolicy().setIdleTimeout(60000);
|
client.getPolicy().setIdleTimeout(60000);
|
||||||
|
@ -80,7 +80,7 @@ public class TimeoutTest
|
|||||||
@Test
|
@Test
|
||||||
public void testIdleDetectedByClient() throws Exception
|
public void testIdleDetectedByClient() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
client.setMaxIdleTimeout(1000);
|
client.setMaxIdleTimeout(1000);
|
||||||
|
@ -85,7 +85,7 @@ public class WebSocketClientBadUriTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBadURI() throws Exception
|
public void testBadURI() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ public class WebSocketClientTest
|
|||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void testAddExtension_NotInstalled() throws Exception
|
public void testAddExtension_NotInstalled() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket cliSock = new TrackingSocket();
|
JettyTrackingSocket cliSock = new JettyTrackingSocket();
|
||||||
|
|
||||||
client.getPolicy().setIdleTimeout(10000);
|
client.getPolicy().setIdleTimeout(10000);
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ public class WebSocketClientTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBasicEcho_FromClient() throws Exception
|
public void testBasicEcho_FromClient() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket cliSock = new TrackingSocket();
|
JettyTrackingSocket cliSock = new JettyTrackingSocket();
|
||||||
|
|
||||||
client.getPolicy().setIdleTimeout(10000);
|
client.getPolicy().setIdleTimeout(10000);
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ public class WebSocketClientTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBasicEcho_FromServer() throws Exception
|
public void testBasicEcho_FromServer() throws Exception
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
Future<Session> future = client.connect(wsocket,server.getWsUri());
|
Future<Session> future = client.connect(wsocket,server.getWsUri());
|
||||||
|
|
||||||
// Server
|
// Server
|
||||||
@ -157,7 +157,7 @@ public class WebSocketClientTest
|
|||||||
fact.start();
|
fact.start();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
@ -197,7 +197,7 @@ public class WebSocketClientTest
|
|||||||
{
|
{
|
||||||
int bufferSize = 512;
|
int bufferSize = 512;
|
||||||
|
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri();
|
URI wsUri = server.getWsUri();
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
@ -235,7 +235,7 @@ public class WebSocketClientTest
|
|||||||
fact.start();
|
fact.start();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TrackingSocket wsocket = new TrackingSocket();
|
JettyTrackingSocket wsocket = new JettyTrackingSocket();
|
||||||
|
|
||||||
URI wsUri = server.getWsUri().resolve("/test?snack=cashews&amount=handful&brand=off");
|
URI wsUri = server.getWsUri().resolve("/test?snack=cashews&amount=handful&brand=off");
|
||||||
Future<Session> future = client.connect(wsocket,wsUri);
|
Future<Session> future = client.connect(wsocket,wsUri);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user