SessionInit extends AbstractSessionState { @Override public void tryWrite(ByteBuf byteBuf) { if(session instanceof BackendSession) { try { ((BackendSession) session).sendAfterProtocol(byteBuf); } catch (Exception e) { throw new UnsupportedOperationException(e); } } else { throw new UnsupportedOperationException("No write through init state"); } } SessionInit(Session session); @Override void tryWrite(ByteBuf byteBuf); @Override String name(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testTryWrite() { sessionInit.tryWrite(new UnpooledByteBufAllocator(true).buffer().writeByte(1)); }