Issue #2210 - fixing flaw in safety checks with JSR356 ClientContainer

This commit is contained in:
Joakim Erdfelt 2018-03-14 16:18:19 -05:00
parent 3ca6f95e0a
commit 93b6877d72
2 changed files with 5 additions and 4 deletions

View File

@ -98,6 +98,7 @@ public class ClientContainer extends ContainerLifeCycle implements WebSocketCont
// This constructor is used with Standalone JSR Client usage. // This constructor is used with Standalone JSR Client usage.
this(new SimpleContainerScope(WebSocketPolicy.newClientPolicy())); this(new SimpleContainerScope(WebSocketPolicy.newClientPolicy()));
client.setDaemon(true); client.setDaemon(true);
client.addManaged(client.getHttpClient());
} }
/** /**
@ -108,6 +109,7 @@ public class ClientContainer extends ContainerLifeCycle implements WebSocketCont
public ClientContainer(final WebSocketContainerScope scope) public ClientContainer(final WebSocketContainerScope scope)
{ {
this(scope, null); this(scope, null);
client.addManaged(client.getHttpClient());
} }
/** /**
@ -136,8 +138,7 @@ public class ClientContainer extends ContainerLifeCycle implements WebSocketCont
new JsrEventDriverFactory(scopeDelegate), new JsrEventDriverFactory(scopeDelegate),
new JsrSessionFactory(this), new JsrSessionFactory(this),
httpClient); httpClient);
this.client.addBean(httpClient);
if(jsr356TrustAll != null) if(jsr356TrustAll != null)
{ {
boolean trustAll = Boolean.parseBoolean(jsr356TrustAll); boolean trustAll = Boolean.parseBoolean(jsr356TrustAll);

View File

@ -406,10 +406,10 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
{ {
Objects.requireNonNull(httpClient, "Provided HttpClient is null"); Objects.requireNonNull(httpClient, "Provided HttpClient is null");
super.doStart();
if (!httpClient.isRunning()) if (!httpClient.isRunning())
throw new IllegalStateException("HttpClient is not running (did you forget to start it?): " + httpClient); throw new IllegalStateException("HttpClient is not running (did you forget to start it?): " + httpClient);
super.doStart();
} }
@Override @Override