The new connectToServer is difficult to use.
Instead of a Class parameter, it should be an object. The container
shouldn't need to instantiate the object, and the Class model makes it
difficult to connect between the client application and the client
endpoint. (Because any shared state/object needs to be passed through a
custom ClientEndpointConfiguration.)
The API should be simplified to:
WebSocketContainer {
Session connectToServer(Object endpoint, URI path);
Session connectToServer(Object endpoint, URI path,
ClientEndpointConfiguration cec);
}
If the "endpoint" object is already of type Endpoint, it's used
directly. Otherwise, a skeleton/proxy is created, i.e. annotation stuff.
There's no need for separate methods for Endpoint vs annotation.
-- Scott