8000 Remove timeout validation, fixes #92 · liborange/rabbitmq-java-client@474121e · GitHub
[go: up one dir, main page]

Skip to content

Commit 474121e

Browse files
Remove timeout validation, fixes rabbitmq#92
1 parent 295cf36 commit 474121e

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

src/com/rabbitmq/client/ConnectionFactory.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,7 @@ public void setConnectionTimeout(int timeout) {
321321
if(timeout < 0) {
322322
throw new IllegalArgumentException("TCP connection timeout cannot be negative");
323323
}
324-
if(timeout > handshakeTimeout) {
325-
throw new IllegalArgumentException("TCP connection timeout cannot be greater than handshake timeout");
326-
} else {
327-
this.connectionTimeout = timeout;
328-
}
324+
this.connectionTimeout = timeout;
329325
}
330326

331327
/**
@@ -352,11 +348,7 @@ public void setHandshakeTimeout(int timeout) {
352348
if(timeout < 0) {
353349
throw new IllegalArgumentException("handshake timeout cannot be negative");
354350
}
355-
if(connectionTimeout != 0 && timeout < connectionTimeout) {
356-
throw new IllegalArgumentException("handshake timeout cannot be lower than TCP connection timeout");
357-
} else {
358-
this.handshakeTimeout = timeout;
359-
}
351+
this.handshakeTimeout = timeout;
360352
}
361353

362354
/**
@@ -561,8 +553,7 @@ public void useSslProtocol(String protocol, TrustManager trustManager)
561553
*
562554
* @param context An initialized SSLContext
563555
*/
564-
public void useSslProtocol(SSLContext context)
565-
{
556+
public void useSslProtocol(SSLContext context) {
566557
setSocketFactory(context.getSocketFactory());
567558
}
568559

test/src/com/rabbitmq/client/test/AMQConnectionTest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,8 @@ public void testNegativeProtocolHandshakeTimeout() {
106106

107107
public void testTCPConnectionTimeoutGreaterThanHandShakeTimeout() {
108108
ConnectionFactory cf = new ConnectionFactory();
109-
try {
110-
cf.setHandshakeTimeout(3000);
111-
cf.setConnectionTimeout(5000);
112-
fail("expected an exception");
113-
} catch (IllegalArgumentException _ignored) {
114-
// expected
115-
}
109+
cf.setHandshakeTimeout(3000);
110+
cf.setConnectionTimeout(5000);
116111
}
117112

118113
public void testProtocolHandshakeTimeoutGreaterThanTCPConnectionTimeout() {

0 commit comments

Comments
 (0)
0