Class BinaryRequestProxyingHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<io.netty.buffer.ByteBuf>
org.mockserver.netty.proxy.BinaryRequestProxyingHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

@Sharable public class BinaryRequestProxyingHandler extends io.netty.channel.SimpleChannelInboundHandler<io.netty.buffer.ByteBuf>
Author:
jamesdbloom
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Constructor Summary

    Constructors
    Constructor
    Description
    BinaryRequestProxyingHandler(org.mockserver.configuration.Configuration configuration, org.mockserver.logging.MockServerLogger mockServerLogger, org.mockserver.scheduler.Scheduler scheduler, org.mockserver.httpclient.NettyHttpClient httpClient, org.mockserver.mock.HttpState httpState)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    channelInactive(io.netty.channel.ChannelHandlerContext ctx)
     
    protected void
    channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf byteBuf)
     
    void
    channelReadComplete(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx)
     
    boolean
    connectBeforeClientSpeaks(io.netty.channel.ChannelHandlerContext ctx)
    Opens the upstream connection of a connection whose client has sent nothing, for a server that speaks first (forwardBinaryServerFirstWaitMillis).
    void
    exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
     
    void
    handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object event)
    A binary client that turns TLS on part way through reaches here once its server certificate is chosen, before anything it sends over TLS is decrypted: the relay then starts TLS with the upstream on the same connection.

    Methods inherited from class io.netty.channel.SimpleChannelInboundHandler

    acceptInboundMessage, channelRead

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelRegistered, channelUnregistered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded
  • Constructor Details

    • BinaryRequestProxyingHandler

      public BinaryRequestProxyingHandler(org.mockserver.configuration.Configuration configuration, org.mockserver.logging.MockServerLogger mockServerLogger, org.mockserver.scheduler.Scheduler scheduler, org.mockserver.httpclient.NettyHttpClient httpClient, org.mockserver.mock.HttpState httpState)
  • Method Details

    • channelRead0

      protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf byteBuf)
      Specified by:
      channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<io.netty.buffer.ByteBuf>
    • connectBeforeClientSpeaks

      public boolean connectBeforeClientSpeaks(io.netty.channel.ChannelHandlerContext ctx)
      Opens the upstream connection of a connection whose client has sent nothing, for a server that speaks first (forwardBinaryServerFirstWaitMillis). Must be called on the connection's event loop.
      Returns:
      false, having opened nothing, for a connection with no target
    • handlerRemoved

      public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      handlerRemoved in interface io.netty.channel.ChannelHandler
      Overrides:
      handlerRemoved in class io.netty.channel.ChannelHandlerAdapter
    • channelReadComplete

      public void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      channelReadComplete in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelReadComplete in class io.netty.channel.ChannelInboundHandlerAdapter
    • channelInactive

      public void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class io.netty.channel.ChannelInboundHandlerAdapter
    • channelWritabilityChanged

      public void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      channelWritabilityChanged in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelWritabilityChanged in class io.netty.channel.ChannelInboundHandlerAdapter
    • userEventTriggered

      public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object event) throws Exception
      A binary client that turns TLS on part way through reaches here once its server certificate is chosen, before anything it sends over TLS is decrypted: the relay then starts TLS with the upstream on the same connection.
      Specified by:
      userEventTriggered in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      userEventTriggered in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelHandler
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      exceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapter