+ public interface UpgradeFrom extends Connection
+ {
+ /* ------------------------------------------------------------ */
+ /** Take the input buffer from the connection on upgrade.
+ * <p>This method is used to take any unconsumed input from
+ * a connection during an upgrade.
+ * @return A buffer of unconsumed input. The caller must return the buffer
+ * to the bufferpool when consumed and this connection must not.
+ */
+ ByteBuffer onUpgradeFrom();
+ }
+
+ public interface UpgradeTo extends Connection
+ {
+ /**
+ * <p>Callback method invoked when this {@link Connection} is upgraded.</p>
+ * <p>This must be called before {@link #onOpen()}.</p>
+ * @param prefilledBuffer An optional buffer that can contain prefilled data. Typically this
+ * results from an upgrade of one protocol to the other where the old connection has buffered
+ * data destined for the new connection. The new connection must take ownership of the buffer
+ * and is responsible for returning it to the buffer pool
+ */
+ void onUpgradeTo(ByteBuffer prefilled);
+ }