Skip to content

Commit

Permalink
Close server sockets in TLS/JSSE tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdettman committed Mar 18, 2017
1 parent 7443022 commit 94abc84
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public void run()
sendResponse(sslSock.getOutputStream());

sslSock.close();
sSock.close();
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,20 @@ public static void main(String[] args)
int port = 5556;

ServerSocket ss = new ServerSocket(port, 16, address);
while (true)
try
{
Socket s = ss.accept();
System.out.println("--------------------------------------------------------------------------------");
System.out.println("Accepted " + s);
ServerThread t = new ServerThread(s);
t.start();
while (true)
{
Socket s = ss.accept();
System.out.println("--------------------------------------------------------------------------------");
System.out.println("Accepted " + s);
ServerThread t = new ServerThread(s);
t.start();
}
}
finally
{
ss.close();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public Exception call()
TestProtocolUtil.doServerProtocol(sslSock, "World");

sslSock.close();
sSock.close();
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ public Exception call()
sslSock.setUseClientMode(false);

TestProtocolUtil.doServerProtocol(sslSock, "World");

sslSock.close();
sSock.close();
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ public Exception call()
this.tlsUnique = TestUtils.getChannelBinding(sslSock, "tls-unique");

TestProtocolUtil.doServerProtocol(sslSock, "World");

sslSock.close();
sSock.close();
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public void run()
sendResponse(sslSock.getOutputStream());

sslSock.close();
sSock.close();
}
catch (Exception e)
{
Expand Down
19 changes: 13 additions & 6 deletions tls/src/test/java/org/bouncycastle/tls/test/TlsServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ public static void main(String[] args)
int port = 5556;

ServerSocket ss = new ServerSocket(port, 16, address);
while (true)
try
{
Socket s = ss.accept();
System.out.println("--------------------------------------------------------------------------------");
System.out.println("Accepted " + s);
ServerThread t = new ServerThread(s);
t.start();
while (true)
{
Socket s = ss.accept();
System.out.println("--------------------------------------------------------------------------------");
System.out.println("Accepted " + s);
ServerThread t = new ServerThread(s);
t.start();
}
}
finally
{
ss.close();
}
}

Expand Down

0 comments on commit 94abc84

Please sign in to comment.