}
@Override
public NextAction handleEvent(FilterChainContext ctx, FilterChainEvent event) throws IOException {
if (event.type() == TunnelRequestEvent.class) {
TunnelRequestEvent tunnelRequestEvent = (TunnelRequestEvent) event;
// Clear ignore status. Any further use of the connection will
// be bound by normal AHC connection processing.
Utils.connectionIgnored(ctx.getConnection(), false);
// Obtain the context that was previously suspended and resume.
// We pass in Invoke Action so the filter chain will call
// handleConnect on the next filter.
FilterChainContext suspendedContext = tunnelRequestEvent.getSuspendedContext();
suspendedContext.resume(ctx.getInvokeAction());
// Stop further event processing.
return ctx.getStopAction();
}