Created
December 14, 2021 16:06
-
-
Save Tom-Ski/53bb43eaf3a8e19e7ddb28d649a0dad3 to your computer and use it in GitHub Desktop.
SSL server name issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
mavenLocal() | |
mavenCentral() | |
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } | |
} | |
dependencies { | |
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.15-SNAPSHOT' | |
} | |
} | |
apply plugin: 'java' | |
apply plugin: 'robovm' | |
sourceCompatibility = 1.8 | |
targetCompatibility = 1.8 | |
repositories { | |
mavenLocal() | |
mavenCentral() | |
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } | |
} | |
ext { | |
roboVMVersion = "2.3.15-SNAPSHOT" | |
} | |
robovm { | |
} | |
dependencies { | |
implementation("com.squareup.okhttp3:okhttp:4.9.0") | |
compile "com.mobidevelop.robovm:robovm-rt:${roboVMVersion}" | |
compile "com.mobidevelop.robovm:robovm-cocoatouch:${roboVMVersion}" | |
testCompile "junit:junit:4.12" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<config> | |
<executableName>${app.executable}</executableName> | |
<mainClass>${app.mainclass}</mainClass> | |
<target>console</target> | |
<forceLinkClasses> | |
<pattern>org.apache.harmony.security.**</pattern> | |
<pattern>com.android.org.conscrypt.**</pattern> | |
<pattern>com.android.org.bouncycastle.**</pattern> | |
<pattern>com.android.okhttp.**</pattern> | |
</forceLinkClasses> | |
</config> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.asidik.test; | |
import okhttp3.Call; | |
import okhttp3.OkHttpClient; | |
import okhttp3.Request; | |
import okhttp3.Response; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import java.net.URLConnection; | |
public class SSLTest { | |
public static void main (String[] args) { | |
System.out.println("Hello RoboVM"); | |
String url = "https://ss-prod-gateway.svc.rockbitegames.com/latest/server-version-raw"; | |
try { | |
OkHttpClient okHttpClient = new OkHttpClient(); | |
Call get = okHttpClient.newCall(new Request.Builder().url(url).method("GET", null).build()); | |
Response execute = get.execute(); | |
System.out.println("OKHTTP -> " + execute.body().string()); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
try { | |
URLConnection urlConnection = new URL(url).openConnection(); | |
BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); | |
String inputLine; | |
while ((inputLine = in.readLine()) != null) | |
System.out.println("URL -> " + inputLine); | |
in.close(); | |
} catch (MalformedURLException e) { | |
e.printStackTrace(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment