package ihc.pokutnik; import com.sun.deploy.config.JREInfo; import com.sun.deploy.ref.DeployJRE; import com.sun.javaws.jnl.JREDesc; import com.sun.jna.platform.mac.SystemB; import com.sun.jna.platform.win32.COM.TypeInfoUtil; import com.sun.jna.platform.win32.WinBase; import com.sun.org.apache.xerces.internal.util.SecurityManager; import javafx.geometry.Side; import jdk.internal.util.xml.impl.Input; import jdk.nashorn.internal.scripts.JD; import org.apache.commons.collections.ArrayStack; import org.apache.commons.collections.Closure; import org.apache.commons.collections.comparators.ComparableComparator; import org.apache.log4j.Category; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.Priority; import org.apache.log4j.spi.LoggingEvent; import sun.applet.AppletSecurity; import sun.plugin2.message.BestJREAvailableMessage; import sun.security.provider.Sun; import sun.tools.jar.resources.jar_sv; import javax.jnlp.DownloadService2; import javax.print.ServiceUI; import javax.swing.*; import java.applet.Applet; import java.io.*; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.net.HttpURLConnection; import java.net.URL; import java.nio.file.FileSystem; import java.nio.file.spi.FileSystemProvider; import java.security.Provider; import java.security.Security; import java.util.Base64; import java.util.Calendar; class Main { /* public static Object deserialize(byte[] data) throws IOException, ClassNotFoundException { ByteArrayInputStream in = new ByteArrayInputStream(data); ObjectInputStream is = new ObjectInputStream(in); return is.readObject(); }*/ static Category cat = Category.getInstance("foo.bar"); int bla = 6; boolean ii = true; public static class GuyInMirror implements Serializable{}; public static class obiekcik implements Serializable { private static final long serialVersionUID = 1L; private int age = 23; private Object iii = new LoggingEvent("uwu",cat, Level.ERROR,null,new Exception("string")); GuyInMirror GuyInMirror = new GuyInMirror(); private Object aaa = new java.applet.Applet(); transient int height; public obiekcik() throws IOException { } // getters and setters } public static void main(String[] args) throws IOException, ClassNotFoundException { URL url = new URL("http://54.177.240.164:28080/object"); String postData = "foo1=bar1&foo2=bar2"; HttpURLConnection conn = (HttpURLConnection) url.openConnection(); class Message implements Serializable{ private final String text; public Message(String text) { this.text = text; } public String getText() { return text; } } String decodedB64 = Base64.getDecoder().decode("ew0KCSJ1cmwiOiAibXlVcmwub3JnL3Byb2R1Y3RzIiwNCgkibnVtIjogMTI1OTY1NA0KfQ==").toString(); // System.out.println(decodedB64); // Object decodedobject = SerializeUtils.deserialize(decodedB64); // System.out.println(decodedobject); Calendar rightNow = Calendar.getInstance(); obiekcik obiekcik = new obiekcik(); try { conn.setRequestMethod("POST"); conn.setDoOutput(true); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-Length", Integer.toString(postData.length())); conn.setUseCaches(false); try (ObjectOutputStream dos = new ObjectOutputStream(conn.getOutputStream())) { //dos.writeObject(new LoggingEvent("uwu",cat, Level.ERROR,null,new Exception("string"))); dos.writeObject(obiekcik.aaa); } try (BufferedReader br = new BufferedReader(new InputStreamReader( conn.getInputStream()))) { String line; while ((line = br.readLine()) != null) { System.out.println(line); } } } catch (Exception e) { e.printStackTrace(); InputStream in = conn.getErrorStream(); int i = in.read(); while (i != -1) { System.out.print((char) i); i = in.read(); } } } }