summaryrefslogtreecommitdiff
path: root/jessie-tests/testServerHelloDone.java
blob: 25a9f59edcf22cf308616847925441d788ed238b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import gnu.javax.net.ssl.provider.Handshake;
import gnu.javax.net.ssl.provider.ServerHelloDone;

import java.nio.ByteBuffer;

class testServerHelloDone
{
  public static void main (String[] argv)
  {
    try
      {
        check ();
      }
    catch (Exception x)
      {
        System.out.println ("FAIL: caught exception " + x);
        x.printStackTrace ();
      }
  }
  
  static void check () throws Exception
  {
    ByteBuffer buffer = ByteBuffer.allocate (4);
    Handshake handshake = new Handshake (buffer);
    handshake.setType (Handshake.Type.SERVER_HELLO_DONE);
    handshake.setLength (0);
    
    // Should not throw ClassCastException
    ServerHelloDone done = (ServerHelloDone) handshake.body ();
    
    System.out.println ("PASS: body()");
    
    System.err.println (handshake);
  }
}