28
28
import java .util .logging .Logger ;
29
29
import org .openqa .selenium .NoSuchSessionException ;
30
30
import org .openqa .selenium .grid .sessionmap .SessionMap ;
31
+ import org .openqa .selenium .internal .Require ;
31
32
import org .openqa .selenium .remote .HttpSessionId ;
32
33
import org .openqa .selenium .remote .SessionId ;
33
34
import org .openqa .selenium .remote .http .BinaryMessage ;
@@ -53,11 +54,12 @@ public ProxyWebsocketsIntoGrid(HttpClient.Factory clientFactory, SessionMap sess
53
54
54
55
@ Override
55
56
public Optional <Consumer <Message >> apply (String uri , Consumer <Message > downstream ) {
56
- Objects . requireNonNull ( uri );
57
- Objects . requireNonNull ( downstream );
57
+ Require . nonNull ( "uri" , uri );
58
+ Require . nonNull ( "downstream" , downstream );
58
59
59
60
Optional <SessionId > sessionId = HttpSessionId .getSessionId (uri ).map (SessionId ::new );
60
- if (!sessionId .isPresent ()) {
61
+ if (sessionId .isEmpty ()) {
62
+ LOG .warning ("Session not found for uri " + uri );
61
63
return Optional .empty ();
62
64
}
63
65
@@ -72,7 +74,7 @@ public Optional<Consumer<Message>> apply(String uri, Consumer<Message> downstrea
72
74
return Optional .of (upstream ::send );
73
75
74
76
} catch (NoSuchSessionException e ) {
75
- LOG .info ("Attempt to connect to non-existent session: " + uri );
77
+ LOG .warning ("Attempt to connect to non-existent session: " + uri );
76
78
return Optional .empty ();
77
79
}
78
80
}
0 commit comments