@Test public void onMessageReceived() { final Connector connector = createConnector(); connector.pauseMessageScheduler(); pauseScheduler(); final Connection connection = newConnection( connector ); final TransportContextImpl context = new TransportContextImpl( connector ); final RequestEntry request = connection.newRequest( ValueUtil.randomString(), false ); assertEquals( connection.getPendingResponses().size(), 0 ); context.onMessageReceived( OkMessage.create( request.getRequestId() ) ); assertEquals( connection.getPendingResponses().size(), 1 ); assertFalse( context.isDisposed() ); context.dispose(); assertTrue( context.isDisposed() ); assertEquals( connection.getPendingResponses().size(), 1 ); context.onMessageReceived( OkMessage.create( 1 ) ); assertEquals( connection.getPendingResponses().size(), 1 ); }
@Override public void onMessageReceived( @Nonnull final ServerToClientMessage message ) { if ( isNotDisposed() ) { if ( SessionCreatedMessage.TYPE.equals( message.getType() ) ) { _connector.onConnection( ( (SessionCreatedMessage) message ).getSessionId() ); } else { final boolean active = _connector.isSchedulerActive(); final boolean paused = _connector.isSchedulerPaused(); _connector.onMessageReceived( message ); if ( !active && !paused && !"visible".equals( DomGlobal.document.visibilityState ) ) { while ( _connector.progressMessages() ) { } } } } }
TransportContextImpl implements TransportContext, Disposable { @Override public void onMessageReceived( @Nonnull final ServerToClientMessage message ) { if ( isNotDisposed() ) { if ( SessionCreatedMessage.TYPE.equals( message.getType() ) ) { _connector.onConnection( ( (SessionCreatedMessage) message ).getSessionId() ); } else { final boolean active = _connector.isSchedulerActive(); final boolean paused = _connector.isSchedulerPaused(); _connector.onMessageReceived( message ); if ( !active && !paused && !"visible".equals( DomGlobal.document.visibilityState ) ) { while ( _connector.progressMessages() ) { } } } } } }
TransportContextImpl implements TransportContext, Disposable { @Override public void onMessageReceived( @Nonnull final ServerToClientMessage message ) { if ( isNotDisposed() ) { if ( SessionCreatedMessage.TYPE.equals( message.getType() ) ) { _connector.onConnection( ( (SessionCreatedMessage) message ).getSessionId() ); } else { final boolean active = _connector.isSchedulerActive(); final boolean paused = _connector.isSchedulerPaused(); _connector.onMessageReceived( message ); if ( !active && !paused && !"visible".equals( DomGlobal.document.visibilityState ) ) { while ( _connector.progressMessages() ) { } } } } } TransportContextImpl( @Nonnull final Connector connector ); }
TransportContextImpl implements TransportContext, Disposable { @Override public void onMessageReceived( @Nonnull final ServerToClientMessage message ) { if ( isNotDisposed() ) { if ( SessionCreatedMessage.TYPE.equals( message.getType() ) ) { _connector.onConnection( ( (SessionCreatedMessage) message ).getSessionId() ); } else { final boolean active = _connector.isSchedulerActive(); final boolean paused = _connector.isSchedulerPaused(); _connector.onMessageReceived( message ); if ( !active && !paused && !"visible".equals( DomGlobal.document.visibilityState ) ) { while ( _connector.progressMessages() ) { } } } } } TransportContextImpl( @Nonnull final Connector connector ); @Override void dispose(); @Override boolean isDisposed(); @Override int newRequestId( @Nullable final String name, final boolean syncRequest ); @Override void onMessageReceived( @Nonnull final ServerToClientMessage message ); @Override void onError(); @Override void onDisconnect(); }
TransportContextImpl implements TransportContext, Disposable { @Override public void onMessageReceived( @Nonnull final ServerToClientMessage message ) { if ( isNotDisposed() ) { if ( SessionCreatedMessage.TYPE.equals( message.getType() ) ) { _connector.onConnection( ( (SessionCreatedMessage) message ).getSessionId() ); } else { final boolean active = _connector.isSchedulerActive(); final boolean paused = _connector.isSchedulerPaused(); _connector.onMessageReceived( message ); if ( !active && !paused && !"visible".equals( DomGlobal.document.visibilityState ) ) { while ( _connector.progressMessages() ) { } } } } } TransportContextImpl( @Nonnull final Connector connector ); @Override void dispose(); @Override boolean isDisposed(); @Override int newRequestId( @Nullable final String name, final boolean syncRequest ); @Override void onMessageReceived( @Nonnull final ServerToClientMessage message ); @Override void onError(); @Override void onDisconnect();  }