On 01/19/2012 02:27 PM, Michal Linhard wrote:
I wanted to test my theory that the hot rod client connection timeout
we
added as part of
https://issues.jboss.org/browse/ISPN-1565
is being ignored
(taking into account
https://issues.jboss.org/browse/ISPN-1755)
I configured both socket timeout and connect timeout for 2 min but in
certain tests I'm getting connection timeuot after cca 20secs.
m.
Also if this is true it has to do someting with JVM Socket
implementation (I'm using oracle's jdk 1.6.0_29)
because the socket.connect(..) is called with correct number (again
taking into account ISPN-1755)
m.
On 01/19/2012 12:01 PM, Manik Surtani wrote:
> What is this for? Perhaps just mock up the client to use a mock socket?
>
> On 19 Jan 2012, at 12:57, Bela Ban wrote:
>
>> If this is done in Java code, you could use byteman to change the behavior.
>>
>> Intercepting and changing the data flow in the TCP/IP stack itself gets
>> more tricky; you have to insert a packet filter and then drop/reorder
>> packets. In Java, you might be able to use jnetpcap, which allows you to
>> get access to the individual packets.
>>
>> Maybe iptables will also allow you to do this, but it's rather static.
>>
>> On 1/18/12 10:05 PM, Michal Linhard wrote:
>>> Hi all,
>>>
>>> probably stupid question from the area of java server programming and
>>> networking if anyone's interrested:
>>> (otherwise sorry for spam)
>>>
>>> is there a simple way of creating a server in java that would always
>>> give me connection timeout ? (not connection refused, nor socket timeout
>>> during read)
>>> is it even possible to control establishing tcp connection from java ?
>>>
>>> what layer does control this ?
>>> it seems that once you bind a socket the connections are automatically
>>> established.
>>> probably on some JVM level ?
>>> so when I get
>>>
>>> java.net.ConnectException: Connection timed out
>>> at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
>>> at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
>>> at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:100)
>>> at
org.infinispan.client.hotrod.impl.transport.tcp.TcpTransport.<init>(TcpTransport.java:80)
>>>
>>>
>>> this means that server JVM or OS networking layer or whatever was so
>>> stressed that it didn't have time to respond with SYN,ACK flagged packet
>>> to establish the connection ?
>>>
>>> m.
>>>
>>>
>>> ----------- my test code:
>>> public class EchoServer {
>>> public static void main(String[] args) {
>>> try {
>>> ServerSocketChannel serverChannel = ServerSocketChannel.open();
>>> InetSocketAddress isa = new
InetSocketAddress("localhost", 9090);
>>> serverChannel.socket().bind(isa);
>>> Thread.sleep(20000);
>>> } catch (Exception e) {
>>> e.printStackTrace();
>>> }
>>>
>>> }
>>> }
>>>
>>> public class EchoClient {
>>> public static void main(String[] args) {
>>> long startTime = System.currentTimeMillis();
>>> try {
>>> SocketAddress serverAddress = new
>>> InetSocketAddress("localhost", 9090);
>>> SocketChannel socketChannel = SocketChannel.open();
>>> Socket socket = socketChannel.socket();
>>> socket.connect(serverAddress, 5000);
>>> socket.setSoTimeout(5000);
>>> BufferedInputStream socketInputStream = new
>>> BufferedInputStream(socket.getInputStream(), socket.getReceiveBufferSize());
>>> BufferedOutputStream socketOutputStream = new
>>> BufferedOutputStream(socket.getOutputStream(), socket.getSendBufferSize());
>>> PrintWriter out = new PrintWriter(socketOutputStream);
>>> out.println("Hello");
>>> out.flush();
>>> BufferedReader in = new BufferedReader(new
>>> InputStreamReader(socketInputStream));
>>> System.out.println(in.readLine());
>>> } catch (Exception e) {
>>> System.out.println("Exception occured after " +
>>> (System.currentTimeMillis() - startTime) + " ms");
>>> e.printStackTrace();
>>> }
>>> }
>>> }
>>>
>> --
>> Bela Ban
>> Lead JGroups (
http://www.jgroups.org)
>> JBoss / Red Hat
>> _______________________________________________
>> infinispan-dev mailing list
>> infinispan-dev(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/infinispan-dev
> --
> Manik Surtani
> manik(a)jboss.org
>
twitter.com/maniksurtani
>
> Lead, Infinispan
>
http://www.infinispan.org
>
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/infinispan-dev
--
Michal Linhard
Quality Assurance Engineer
JBoss Enterprise Datagrid
Red Hat Czech s.r.o.
Purkynova 99 612 45 Brno, Czech Republic
phone: +420 532 294 320 ext. 62320
mobile: +420 728 626 363