Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ static public InputStreamReader reader(InputStream in) {
//----------------------------------------------------------------------------------------------
static public boolean isPortActive(String host, int port) {
Socket s = null;
if (port < 0 || port > 65535) {
throw new IllegalArgumentException("Port value passed is outside the specified range of valid port values");
}
try {
s = new Socket();
s.setReuseAddress(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.urbancode.terraform.tasks.helpers;

import java.net.URL;

import org.junit.Assert;
import org.junit.Test;

import com.urbancode.terraform.tasks.aws.helpers.SshHelper;

public class SshHelperTest {

@Test(expected=IllegalArgumentException.class)
public void isPortActiveTest() {
SshHelper.isPortActive("127.0.0.1", 65536);
}

}