@Test public void successfulHandshakeV2_V2() throws Exception { setupProtocol(CougarProtocol.TRANSPORT_PROTOCOL_VERSION_BIDIRECTION_RPC, CougarProtocol.TRANSPORT_PROTOCOL_VERSION_BIDIRECTION_RPC); client.sessionOpened(nextFilter, clientSession); ClientHandshake handshake = (ClientHandshake) clientSession.getAttribute(ClientHandshake.HANDSHAKE); assertTrue(handshake.await(5000)); assertTrue(handshake.successful()); assertEquals(CougarProtocol.TRANSPORT_PROTOCOL_VERSION_BIDIRECTION_RPC, clientSession.getAttribute(CougarProtocol.PROTOCOL_VERSION_ATTR_NAME)); assertEquals(CougarProtocol.TRANSPORT_PROTOCOL_VERSION_BIDIRECTION_RPC, serverSession.getAttribute(CougarProtocol.PROTOCOL_VERSION_ATTR_NAME)); }
@Override public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception { if (!isServer) { ClientHandshake clientHandshake = new ClientHandshake(); session.setAttribute(ClientHandshake.HANDSHAKE, clientHandshake); session.write(new ConnectMessage(getClientAcceptableVersions())); } super.sessionOpened(nextFilter, session); }
CougarProtocol extends IoFilterAdapter implements Exportable { @Override public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception { if (!isServer) { ClientHandshake clientHandshake = new ClientHandshake(); session.setAttribute(ClientHandshake.HANDSHAKE, clientHandshake); session.write(new ConnectMessage(getClientAcceptableVersions())); } super.sessionOpened(nextFilter, session); } }
CougarProtocol extends IoFilterAdapter implements Exportable { @Override public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception { if (!isServer) { ClientHandshake clientHandshake = new ClientHandshake(); session.setAttribute(ClientHandshake.HANDSHAKE, clientHandshake); session.write(new ConnectMessage(getClientAcceptableVersions())); } super.sessionOpened(nextFilter, session); } protected  CougarProtocol(boolean server, NioLogger nioLogger, int keepAliveInterval, int keepAliveTimeout, SSLFilter sslFilter, boolean supportsTls, boolean requiresTls, long rpcTimeoutMillis); }
CougarProtocol extends IoFilterAdapter implements Exportable { @Override public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception { if (!isServer) { ClientHandshake clientHandshake = new ClientHandshake(); session.setAttribute(ClientHandshake.HANDSHAKE, clientHandshake); session.write(new ConnectMessage(getClientAcceptableVersions())); } super.sessionOpened(nextFilter, session); } protected  CougarProtocol(boolean server, NioLogger nioLogger, int keepAliveInterval, int keepAliveTimeout, SSLFilter sslFilter, boolean supportsTls, boolean requiresTls, long rpcTimeoutMillis); static void setMaxServerProtocolVersion(byte maxServerProtocolVersion); static void setMaxClientProtocolVersion(byte maxClientProtocolVersion); static void setMinServerProtocolVersion(byte minServerProtocolVersion); static void setMinClientProtocolVersion(byte minClientProtocolVersion); static Set<TranscribableParams> getTranscribableParamSet(IoSession session); static Set<TranscribableParams> getTranscribableParamSet(byte protocolVersion); static CougarProtocol getClientInstance(NioLogger nioLogger, int keepAliveInterval, int keepAliveTimeout, SSLFilter sslFilter, boolean supportsTls, boolean requiresTls, long rpcTimeoutMillis); static CougarProtocol getServerInstance(NioLogger nioLogger, int keepAliveInterval, int keepAliveTimeout, SSLFilter sslFilter, boolean supportsTls, boolean requiresTls); void closeSession(final IoSession ioSession); void closeSession(final IoSession ioSession, boolean blockUntilComplete); void suspendSession(final IoSession ioSession); @Override void sessionOpened(NextFilter nextFilter, IoSession session); @Override void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status); @Override void sessionCreated(NextFilter nextFilter, IoSession session); static byte getProtocolVersion(IoSession session); @Override void messageReceived(NextFilter nextFilter, IoSession session, Object message); @ManagedAttribute void setEnabled(boolean healthy); @ManagedAttribute boolean isEnabled(); @Override void export(JMXControl jmxControl); @ManagedAttribute int getInterval(); @ManagedAttribute int getTimeout(); @ManagedAttribute long getHeartbeatsMissed(); @ManagedAttribute long getHeartbeatsSent(); @ManagedAttribute long getSessionsCreated(); @ManagedAttribute String getLastSessionFrom(); @ManagedAttribute boolean isSupportsTls(); @ManagedAttribute boolean isRequiresTls(); }
CougarProtocol extends IoFilterAdapter implements Exportable { @Override public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception { if (!isServer) { ClientHandshake clientHandshake = new ClientHandshake(); session.setAttribute(ClientHandshake.HANDSHAKE, clientHandshake); session.write(new ConnectMessage(getClientAcceptableVersions())); } super.sessionOpened(nextFilter, session); } protected  CougarProtocol(boolean server, NioLogger nioLogger, int keepAliveInterval, int keepAliveTimeout, SSLFilter sslFilter, boolean supportsTls, boolean requiresTls, long rpcTimeoutMillis); static void setMaxServerProtocolVersion(byte maxServerProtocolVersion); static void setMaxClientProtocolVersion(byte maxClientProtocolVersion); static void setMinServerProtocolVersion(byte minServerProtocolVersion); static void setMinClientProtocolVersion(byte minClientProtocolVersion); static Set<TranscribableParams> getTranscribableParamSet(IoSession session); static Set<TranscribableParams> getTranscribableParamSet(byte protocolVersion); static CougarProtocol getClientInstance(NioLogger nioLogger, int keepAliveInterval, int keepAliveTimeout, SSLFilter sslFilter, boolean supportsTls, boolean requiresTls, long rpcTimeoutMillis); static CougarProtocol getServerInstance(NioLogger nioLogger, int keepAliveInterval, int keepAliveTimeout, SSLFilter sslFilter, boolean supportsTls, boolean requiresTls); void closeSession(final IoSession ioSession); void closeSession(final IoSession ioSession, boolean blockUntilComplete); void suspendSession(final IoSession ioSession); @Override void sessionOpened(NextFilter nextFilter, IoSession session); @Override void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status); @Override void sessionCreated(NextFilter nextFilter, IoSession session); static byte getProtocolVersion(IoSession session); @Override void messageReceived(NextFilter nextFilter, IoSession session, Object message); @ManagedAttribute void setEnabled(boolean healthy); @ManagedAttribute boolean isEnabled(); @Override void export(JMXControl jmxControl); @ManagedAttribute int getInterval(); @ManagedAttribute int getTimeout(); @ManagedAttribute long getHeartbeatsMissed(); @ManagedAttribute long getHeartbeatsSent(); @ManagedAttribute long getSessionsCreated(); @ManagedAttribute String getLastSessionFrom(); @ManagedAttribute boolean isSupportsTls(); @ManagedAttribute boolean isRequiresTls(); static final String PROTOCOL_VERSION_ATTR_NAME; static final String IS_SERVER_ATTR_NAME; static final String NEGOTIATED_TLS_LEVEL_ATTR_NAME; static final String CLIENT_CERTS_ATTR_NAME; static final String TSSF_ATTR_NAME; static final byte TRANSPORT_PROTOCOL_VERSION_CLIENT_ONLY_RPC; static final byte TRANSPORT_PROTOCOL_VERSION_BIDIRECTION_RPC; static final byte TRANSPORT_PROTOCOL_VERSION_START_TLS; static final byte TRANSPORT_PROTOCOL_VERSION_TIME_CONSTRAINTS; static final byte TRANSPORT_PROTOCOL_VERSION_COMPOUND_REQUEST_UUID; static final byte TRANSPORT_PROTOCOL_VERSION_MIN_SUPPORTED; static final byte TRANSPORT_PROTOCOL_VERSION_MAX_SUPPORTED; static final byte TRANSPORT_PROTOCOL_VERSION_UNSUPPORTED; }