@Test public void disconnect() { pauseScheduler(); final Connector connector = createConnector(); newConnection( connector ); safeAction( () -> connector.setState( ConnectorState.CONNECTED ) ); safeAction( connector::disconnect ); verify( connector.getTransport() ).requestDisconnect(); assertEquals( connector.getState(), ConnectorState.DISCONNECTING ); verify( connector.getTransport(), never() ).unbind(); }
void disconnect() { final ConnectorState state = getState(); if ( ConnectorState.DISCONNECTING != state && ConnectorState.DISCONNECTED != state ) { ConnectorState newState = ConnectorState.ERROR; try { _transport.requestDisconnect(); newState = ConnectorState.DISCONNECTING; } finally { setState( newState ); } } }
Connector extends ReplicantService { void disconnect() { final ConnectorState state = getState(); if ( ConnectorState.DISCONNECTING != state && ConnectorState.DISCONNECTED != state ) { ConnectorState newState = ConnectorState.ERROR; try { _transport.requestDisconnect(); newState = ConnectorState.DISCONNECTING; } finally { setState( newState ); } } } }
Connector extends ReplicantService { void disconnect() { final ConnectorState state = getState(); if ( ConnectorState.DISCONNECTING != state && ConnectorState.DISCONNECTED != state ) { ConnectorState newState = ConnectorState.ERROR; try { _transport.requestDisconnect(); newState = ConnectorState.DISCONNECTING; } finally { setState( newState ); } } } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); }
Connector extends ReplicantService { void disconnect() { final ConnectorState state = getState(); if ( ConnectorState.DISCONNECTING != state && ConnectorState.DISCONNECTED != state ) { ConnectorState newState = ConnectorState.ERROR; try { _transport.requestDisconnect(); newState = ConnectorState.DISCONNECTING; } finally { setState( newState ); } } } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); @Override String toString(); }
Connector extends ReplicantService { void disconnect() { final ConnectorState state = getState(); if ( ConnectorState.DISCONNECTING != state && ConnectorState.DISCONNECTED != state ) { ConnectorState newState = ConnectorState.ERROR; try { _transport.requestDisconnect(); newState = ConnectorState.DISCONNECTING; } finally { setState( newState ); } } } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); @Override String toString();  }