Merge branch 'master' into websocket-ssl
This commit is contained in:
commit
b3c32651ff
|
@ -143,7 +143,7 @@ public class SPDYClient
|
||||||
|
|
||||||
protected SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel)
|
protected SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel)
|
||||||
{
|
{
|
||||||
String peerHost = channel.socket().getInetAddress().getHostAddress();
|
String peerHost = channel.socket().getInetAddress().getHostName();
|
||||||
int peerPort = channel.socket().getPort();
|
int peerPort = channel.socket().getPort();
|
||||||
SSLEngine engine = sslContextFactory.newSSLEngine(peerHost, peerPort);
|
SSLEngine engine = sslContextFactory.newSSLEngine(peerHost, peerPort);
|
||||||
engine.setUseClientMode(true);
|
engine.setUseClientMode(true);
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class WebSocketClientSelectorManager extends SelectorManager
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
LOG.debug(e);
|
LOG.ignore(e);
|
||||||
connectPromise.failed(e);
|
connectPromise.failed(e);
|
||||||
// rethrow
|
// rethrow
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -120,7 +120,7 @@ public class WebSocketClientSelectorManager extends SelectorManager
|
||||||
|
|
||||||
public SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel)
|
public SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel)
|
||||||
{
|
{
|
||||||
String peerHost = channel.socket().getInetAddress().getHostAddress();
|
String peerHost = channel.socket().getInetAddress().getHostName();
|
||||||
int peerPort = channel.socket().getPort();
|
int peerPort = channel.socket().getPort();
|
||||||
SSLEngine engine = sslContextFactory.newSSLEngine(peerHost,peerPort);
|
SSLEngine engine = sslContextFactory.newSSLEngine(peerHost,peerPort);
|
||||||
engine.setUseClientMode(true);
|
engine.setUseClientMode(true);
|
||||||
|
|
|
@ -245,11 +245,14 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
|
||||||
@Override
|
@Override
|
||||||
public RemoteEndpoint getRemote()
|
public RemoteEndpoint getRemote()
|
||||||
{
|
{
|
||||||
if (!isOpen())
|
ConnectionState state = connection.getIOState().getConnectionState();
|
||||||
|
|
||||||
|
if ((state == ConnectionState.OPEN) || (state == ConnectionState.CONNECTED))
|
||||||
{
|
{
|
||||||
throw new WebSocketException("Session has not been opened yet");
|
return remote;
|
||||||
}
|
}
|
||||||
return remote;
|
|
||||||
|
throw new WebSocketException("RemoteEndpoint unavailable, current state [" + state + "], expecting [OPEN or CONNECTED]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue