@Test public void closeAsync() throws Exception { AtomicBoolean credentialsVerifierClosed = new AtomicBoolean(); AtomicBoolean nextServiceClosed = new AtomicBoolean(); StreamingHttpServiceFilter service = new BasicAuthHttpServiceFilter.Builder<>( new CredentialsVerifier<BasicUserInfo>() { @Override public Single<BasicUserInfo> apply(final String userId, final String password) { return never(); } @Override public Completable closeAsync() { return completed().beforeOnComplete(() -> credentialsVerifierClosed.set(true)); } }, REALM_VALUE) .buildServer() .create(new StreamingHttpService() { @Override public Single<StreamingHttpResponse> handle(final HttpServiceContext ctx, final StreamingHttpRequest request, final StreamingHttpResponseFactory factory) { return never(); } @Override public Completable closeAsync() { return completed().beforeOnComplete(() -> nextServiceClosed.set(true)); } }); assertFalse(credentialsVerifierClosed.get()); assertFalse(nextServiceClosed.get()); service.closeAsync().toFuture().get(); assertTrue(credentialsVerifierClosed.get()); assertTrue(nextServiceClosed.get()); }
@Override public StreamingHttpServiceFilter create(final StreamingHttpService service) { return new BasicAuthStreamingHttpService<>(this, service); }
BasicAuthHttpServiceFilter implements StreamingHttpServiceFilterFactory, HttpExecutionStrategyInfluencer { @Override public StreamingHttpServiceFilter create(final StreamingHttpService service) { return new BasicAuthStreamingHttpService<>(this, service); } }
BasicAuthHttpServiceFilter implements StreamingHttpServiceFilterFactory, HttpExecutionStrategyInfluencer { @Override public StreamingHttpServiceFilter create(final StreamingHttpService service) { return new BasicAuthStreamingHttpService<>(this, service); } private  BasicAuthHttpServiceFilter(final CredentialsVerifier<UserInfo> credentialsVerifier,
                                       final String realm,
                                       final boolean proxy,
                                       @Nullable final Key<UserInfo> userInfoKey,
                                       final boolean utf8); }
BasicAuthHttpServiceFilter implements StreamingHttpServiceFilterFactory, HttpExecutionStrategyInfluencer { @Override public StreamingHttpServiceFilter create(final StreamingHttpService service) { return new BasicAuthStreamingHttpService<>(this, service); } private  BasicAuthHttpServiceFilter(final CredentialsVerifier<UserInfo> credentialsVerifier,
                                       final String realm,
                                       final boolean proxy,
                                       @Nullable final Key<UserInfo> userInfoKey,
                                       final boolean utf8); @Override StreamingHttpServiceFilter create(final StreamingHttpService service); @Override HttpExecutionStrategy influenceStrategy(final HttpExecutionStrategy strategy); }
BasicAuthHttpServiceFilter implements StreamingHttpServiceFilterFactory, HttpExecutionStrategyInfluencer { @Override public StreamingHttpServiceFilter create(final StreamingHttpService service) { return new BasicAuthStreamingHttpService<>(this, service); } private  BasicAuthHttpServiceFilter(final CredentialsVerifier<UserInfo> credentialsVerifier,
                                       final String realm,
                                       final boolean proxy,
                                       @Nullable final Key<UserInfo> userInfoKey,
                                       final boolean utf8); @Override StreamingHttpServiceFilter create(final StreamingHttpService service); @Override HttpExecutionStrategy influenceStrategy(final HttpExecutionStrategy strategy);  }