Merge branch 'master' into websocket-ssl

This commit is contained in:
Joakim Erdfelt 2013-06-14 11:40:02 -07:00
commit b3c32651ff
3 changed files with 9 additions and 6 deletions

View File

@ -143,7 +143,7 @@ public class SPDYClient
protected SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel)
{
String peerHost = channel.socket().getInetAddress().getHostAddress();
String peerHost = channel.socket().getInetAddress().getHostName();
int peerPort = channel.socket().getPort();
SSLEngine engine = sslContextFactory.newSSLEngine(peerHost, peerPort);
engine.setUseClientMode(true);

View File

@ -104,7 +104,7 @@ public class WebSocketClientSelectorManager extends SelectorManager
}
catch (IOException e)
{
LOG.debug(e);
LOG.ignore(e);
connectPromise.failed(e);
// rethrow
throw e;
@ -120,7 +120,7 @@ public class WebSocketClientSelectorManager extends SelectorManager
public SSLEngine newSSLEngine(SslContextFactory sslContextFactory, SocketChannel channel)
{
String peerHost = channel.socket().getInetAddress().getHostAddress();
String peerHost = channel.socket().getInetAddress().getHostName();
int peerPort = channel.socket().getPort();
SSLEngine engine = sslContextFactory.newSSLEngine(peerHost,peerPort);
engine.setUseClientMode(true);

View File

@ -245,11 +245,14 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
@Override
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