-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
31 changes: 31 additions & 0 deletions
31
src/test/java/com/osiris/autoplug/client/SystemCheckerTest.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (c) 2023 Osiris-Team. | ||
* All rights reserved. | ||
* | ||
* This software is copyrighted work, licensed under the terms | ||
* of the MIT-License. Consult the "LICENSE" file for details. | ||
*/ | ||
|
||
package com.osiris.autoplug.client; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.net.HttpURLConnection; | ||
import java.net.InetAddress; | ||
import java.net.URL; | ||
|
||
class SystemCheckerTest { | ||
|
||
@Test | ||
void checkInternetAccessMethod1() throws Exception { | ||
boolean reachable = InetAddress.getByName("www.google.com").isReachable(10000); | ||
if (!reachable) throw new Exception("Failed to reach www.google.com!"); | ||
} | ||
|
||
@Test | ||
void checkInternetAccessMethod2() throws Exception { | ||
HttpURLConnection connection = (HttpURLConnection) new URL("https://www.google.com").openConnection(); | ||
connection.connect(); | ||
connection.disconnect(); | ||
} | ||
} |