Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasGrether committed Mar 5, 2024
1 parent e4f4dec commit a8ea322
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
20 changes: 18 additions & 2 deletions src/main/java/org/nethergames/proxytransport/ProxyTransport.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
import dev.waterdog.waterdogpe.network.protocol.ProtocolCodecs;
import dev.waterdog.waterdogpe.plugin.Plugin;
import io.netty.incubator.codec.quic.Quic;
import io.netty.util.internal.NativeLibraryLoader;
import org.nethergames.proxytransport.integration.QuicTransportServerInfo;
import org.nethergames.proxytransport.integration.TcpTransportServerInfo;
import org.nethergames.proxytransport.utils.CodecUpdater;
import org.scijava.nativelib.NativeLoader;
import org.nethergames.proxytransport.utils.NativeUtils;

import java.io.FileNotFoundException;
import java.io.IOException;
Expand All @@ -16,8 +15,25 @@
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;


public class ProxyTransport extends Plugin {

static {
System.out.println("-------------- 1 --------------");
try{
loadLibrary();
}catch(Throwable t) {
System.out.println(t);
}

System.out.println("-------------- 2 --------------");
try{
NativeUtils.loadLibraryFromJar("/META-INF/native/libnetty_quiche_linux_x86_64.so");
}catch(Throwable t) {
System.out.println(t);
}
}

@Override
public void onStartup() {
ProtocolCodecs.addUpdater(new CodecUpdater());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
*/
package org.nethergames.proxytransport.utils;

import org.nethergames.proxytransport.ProxyTransport;

import java.io.*;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.FileSystems;
Expand Down Expand Up @@ -95,7 +97,7 @@ public static void loadLibraryFromJar(String path) throws IOException {

File temp = new File(temporaryDir, filename);

try (InputStream is = NativeUtils.class.getResourceAsStream(path)) {
try (InputStream is = ProxyTransport.class.getResourceAsStream(path)) {
Files.copy(is, temp.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
temp.delete();
Expand Down

0 comments on commit a8ea322

Please sign in to comment.