@Test public void testAddEncoder() throws Exception { ChannelOutboundHandler encoder = getEncoder(); HandlerFactory handler = HandlerFactory.instanceAddEncoder(encoder, HandlerFactory.Position.END); assertNotNull(handler); assertEquals(2, handler.getEncoders().length); assertNotEquals(encoder, handler.getEncoders()[0]); assertEquals(encoder, handler.getEncoders()[1]); encoder = getEncoder(); handler.addEncoder(encoder, HandlerFactory.Position.BEGIN); assertEquals(3, handler.getEncoders().length); assertNotEquals(encoder, handler.getEncoders()[0]); assertEquals(encoder, handler.getEncoders()[1]); assertNotEquals(encoder, handler.getEncoders()[2]); }
public synchronized HandlerFactory addEncoder(ChannelOutboundHandler encoder, Position pos) { Preconditions.checkNotNull(encoder); Preconditions.checkNotNull(pos); if (Position.END.equals(pos)) { encoders.addLast(encoder); } else { encoders.addFirst(encoder); } return this; }
HandlerFactory { public synchronized HandlerFactory addEncoder(ChannelOutboundHandler encoder, Position pos) { Preconditions.checkNotNull(encoder); Preconditions.checkNotNull(pos); if (Position.END.equals(pos)) { encoders.addLast(encoder); } else { encoders.addFirst(encoder); } return this; } }
HandlerFactory { public synchronized HandlerFactory addEncoder(ChannelOutboundHandler encoder, Position pos) { Preconditions.checkNotNull(encoder); Preconditions.checkNotNull(pos); if (Position.END.equals(pos)) { encoders.addLast(encoder); } else { encoders.addFirst(encoder); } return this; }  }
HandlerFactory { public synchronized HandlerFactory addEncoder(ChannelOutboundHandler encoder, Position pos) { Preconditions.checkNotNull(encoder); Preconditions.checkNotNull(pos); if (Position.END.equals(pos)) { encoders.addLast(encoder); } else { encoders.addFirst(encoder); } return this; }  static HandlerFactory instanceAddDecoder(ChannelInboundHandler decoder, Position pos); static HandlerFactory instanceAddEncoder(ChannelOutboundHandler encoder, Position pos); synchronized HandlerFactory addDecoder(ChannelInboundHandler decoder, Position pos); synchronized HandlerFactory addEncoder(ChannelOutboundHandler encoder, Position pos); synchronized ChannelHandler[] getDecoders(); synchronized ChannelHandler[] getEncoders(); }
HandlerFactory { public synchronized HandlerFactory addEncoder(ChannelOutboundHandler encoder, Position pos) { Preconditions.checkNotNull(encoder); Preconditions.checkNotNull(pos); if (Position.END.equals(pos)) { encoders.addLast(encoder); } else { encoders.addFirst(encoder); } return this; }  static HandlerFactory instanceAddDecoder(ChannelInboundHandler decoder, Position pos); static HandlerFactory instanceAddEncoder(ChannelOutboundHandler encoder, Position pos); synchronized HandlerFactory addDecoder(ChannelInboundHandler decoder, Position pos); synchronized HandlerFactory addEncoder(ChannelOutboundHandler encoder, Position pos); synchronized ChannelHandler[] getDecoders(); synchronized ChannelHandler[] getEncoders();  }