File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/java/nginx/clojure/net Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,21 @@ public SocketImpl createSocketImpl() {
31
31
Class <?> socketImpClz = Thread .currentThread ().getContextClassLoader ().loadClass ("java.net.SocksSocketImpl" );
32
32
@ SuppressWarnings ("unchecked" )
33
33
Constructor <SocketImpl > socketConstructor = (Constructor <SocketImpl >) socketImpClz .getDeclaredConstructor ();
34
- socketConstructor .setAccessible (true );
34
+ socketConstructor .setAccessible (true );
35
35
return socketConstructor .newInstance ();
36
+ } catch (NoSuchMethodException e ) { // for jdk13+
37
+ Class <?> socketImpClz ;
38
+ try {
39
+ socketImpClz = Thread .currentThread ().getContextClassLoader ().loadClass ("sun.nio.ch.NioSocketImpl" );
40
+ @ SuppressWarnings ("unchecked" )
41
+ Constructor <SocketImpl > socketConstructor = (Constructor <SocketImpl >) socketImpClz .getDeclaredConstructor (Boolean .TYPE );
42
+ socketConstructor .setAccessible (true );
43
+ return socketConstructor .newInstance (false );
44
+ } catch (InvocationTargetException ex ) {
45
+ throw new RuntimeException (ex .getCause ());
46
+ } catch (Throwable ex ) {
47
+ throw new RuntimeException (ex );
48
+ }
36
49
} catch (InvocationTargetException e ) {
37
50
throw new RuntimeException (e .getCause ());
38
51
} catch (Throwable e ) {
You can’t perform that action at this time.
0 commit comments