Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ protected void handlerAdded0(final ChannelHandlerContext ctx) {

@Override
public void updateSslContext(SslContext sslContext) {
if (ctx.isRemoved()) {
return;
}
logger.log(
Level.FINEST,
"ClientSdsHandler.updateSslContext authority={0}, ctx.name={1}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,36 @@ protected void onException(Throwable throwable) {
CommonCertProviderTestUtils.register0();
}

@Test
public void clientSdsProtocolNegotiatorNewHandler_handleHandlerRemoved() {
FakeClock executor = new FakeClock();
CommonCertProviderTestUtils.register(executor);
Bootstrapper.BootstrapInfo bootstrapInfoForClient = CommonBootstrapperTestUtils
.buildBootstrapInfo("google_cloud_private_spiffe-client", CLIENT_KEY_FILE, CLIENT_PEM_FILE,
CA_PEM_FILE, null, null, null, null);
UpstreamTlsContext upstreamTlsContext =
CommonTlsContextTestsUtil
.buildUpstreamTlsContext("google_cloud_private_spiffe-client", true);

SslContextProviderSupplier sslContextProviderSupplier =
new SslContextProviderSupplier(upstreamTlsContext,
new TlsContextManagerImpl(bootstrapInfoForClient));
SecurityProtocolNegotiators.ClientSdsHandler clientSdsHandler =
new SecurityProtocolNegotiators.ClientSdsHandler(grpcHandler, sslContextProviderSupplier);

pipeline.addLast(clientSdsHandler);
channelHandlerCtx = pipeline.context(clientSdsHandler);

// kick off protocol negotiation.
pipeline.fireUserEventTriggered(InternalProtocolNegotiationEvent.getDefault());

executor.runDueTasks();
pipeline.remove(clientSdsHandler);
channel.runPendingTasks();
channel.checkException();
CommonCertProviderTestUtils.register0();
}

private static final class FakeGrpcHttp2ConnectionHandler extends GrpcHttp2ConnectionHandler {

FakeGrpcHttp2ConnectionHandler(
Expand Down