1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-06-15 16:14:49 +02:00

Fix issue with Socks5ProxyTest: The read() method throws an Exception if the socket is closed. Catch this Exception and report the testcase as successful.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13385 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Florian Schmaus 2013-01-04 11:47:53 +00:00 committed by flow
parent 8c14f0cb55
commit efacd34b2e

View file

@ -13,19 +13,23 @@
*/
package org.jivesoftware.smackx.bytestreams.socks5;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smackx.bytestreams.socks5.Socks5Proxy;
import org.junit.After;
import org.junit.Test;
@ -191,7 +195,14 @@ public class Socks5ProxyTest {
OutputStream out = socket.getOutputStream();
out.write(new byte[] { 1, 2, 3 });
assertEquals(-1, socket.getInputStream().read());
int res;
try {
res = socket.getInputStream().read();
} catch (SocketException e) {
res = -1;
}
assertEquals(-1, res);
proxy.stop();