1717
1818import java .nio .ByteBuffer ;
1919import java .nio .channels .ClosedChannelException ;
20- import java .security .Principal ;
21- import java .security .cert .Certificate ;
2220import java .util .List ;
2321import java .util .concurrent .atomic .AtomicInteger ;
2422import java .util .concurrent .atomic .AtomicReference ;
3028import javax .net .ssl .SSLEngineResult ;
3129import javax .net .ssl .SSLException ;
3230import javax .net .ssl .SSLParameters ;
33- import javax .net .ssl .SSLPeerUnverifiedException ;
3431import javax .net .ssl .SSLSession ;
35- import javax .net .ssl .SSLSessionContext ;
3632
3733import io .undertow .UndertowMessages ;
3834
@@ -204,100 +200,14 @@ class InitialState extends SSLEngine {
204200 private final SNIContextMatcher selector ;
205201 private final AtomicInteger flags = new AtomicInteger (FL_SESSION_CRE );
206202 private final Function <SSLContext , SSLEngine > engineFunction ;
207- private int packetBufferSize = SNISSLExplorer .RECORD_HEADER_SIZE ;
208203 private String [] enabledSuites ;
209204 private String [] enabledProtocols ;
210205
211- private final SSLSession handshakeSession = new SSLSession () {
212- public byte [] getId () {
213- throw new UnsupportedOperationException ();
214- }
215-
216- public SSLSessionContext getSessionContext () {
217- throw new UnsupportedOperationException ();
218- }
219-
220- public long getCreationTime () {
221- throw new UnsupportedOperationException ();
222- }
223-
224- public long getLastAccessedTime () {
225- throw new UnsupportedOperationException ();
226- }
227-
228- public void invalidate () {
229- throw new UnsupportedOperationException ();
230- }
231-
232- public boolean isValid () {
233- return false ;
234- }
235-
236- public void putValue (final String s , final Object o ) {
237- throw new UnsupportedOperationException ();
238- }
239-
240- public Object getValue (final String s ) {
241- return null ;
242- }
243-
244- public void removeValue (final String s ) {
245- }
246-
247- public String [] getValueNames () {
248- throw new UnsupportedOperationException ();
249- }
250-
251- public Certificate [] getPeerCertificates () throws SSLPeerUnverifiedException {
252- throw new UnsupportedOperationException ();
253- }
254-
255- public Certificate [] getLocalCertificates () {
256- return null ;
257- }
258-
259- public Principal getPeerPrincipal () throws SSLPeerUnverifiedException {
260- throw new UnsupportedOperationException ();
261- }
262-
263- public Principal getLocalPrincipal () {
264- throw new UnsupportedOperationException ();
265- }
266-
267- public String getCipherSuite () {
268- throw new UnsupportedOperationException ();
269- }
270-
271- public String getProtocol () {
272- throw new UnsupportedOperationException ();
273- }
274-
275- public String getPeerHost () {
276- return SNISSLEngine .this .getPeerHost ();
277- }
278-
279- public int getPeerPort () {
280- return SNISSLEngine .this .getPeerPort ();
281- }
282-
283- public int getPacketBufferSize () {
284- return packetBufferSize ;
285- }
286-
287- public int getApplicationBufferSize () {
288- throw new UnsupportedOperationException ();
289- }
290- };
291-
292206 InitialState (final SNIContextMatcher selector , final Function <SSLContext , SSLEngine > engineFunction ) {
293207 this .selector = selector ;
294208 this .engineFunction = engineFunction ;
295209 }
296210
297- public SSLSession getHandshakeSession () {
298- return handshakeSession ;
299- }
300-
301211 public SSLEngineResult wrap (final ByteBuffer [] srcs , final int offset , final int length , final ByteBuffer dst ) throws SSLException {
302212 return OK_UNWRAP ;
303213 }
@@ -307,12 +217,10 @@ public SSLEngineResult unwrap(final ByteBuffer src, final ByteBuffer[] dsts, fin
307217 final int mark = src .position ();
308218 try {
309219 if (src .remaining () < SNISSLExplorer .RECORD_HEADER_SIZE ) {
310- packetBufferSize = SNISSLExplorer .RECORD_HEADER_SIZE ;
311220 return UNDERFLOW_UNWRAP ;
312221 }
313222 final int requiredSize = SNISSLExplorer .getRequiredSize (src );
314223 if (src .remaining () < requiredSize ) {
315- packetBufferSize = requiredSize ;
316224 return UNDERFLOW_UNWRAP ;
317225 }
318226 List <SNIServerName > names = SNISSLExplorer .explore (src );
0 commit comments