Helper to unwrap a wrapped buffer, pretending the sasl client simply prepends the length. @throws Exception Exception it really shouldn't. Really.
()
| 154 | * @throws Exception Exception it really shouldn't. Really. |
| 155 | */ |
| 156 | protected void setupUnwrap() throws Exception { |
| 157 | // TODO - figure out a way to use real wrapping. For now we just stick on |
| 158 | // two bytes or take em off. |
| 159 | when(sasl_client.unwrap(any(byte[].class), anyInt(), anyInt())) |
| 160 | .thenAnswer(new Answer<byte[]>() { |
| 161 | @Override |
| 162 | public byte[] answer(final InvocationOnMock invocation) |
| 163 | throws Throwable { |
| 164 | final byte[] buffer = (byte[])invocation.getArguments()[0]; |
| 165 | final int length = (Integer)invocation.getArguments()[2]; |
| 166 | final byte[] unwrapped = new byte[length - 4]; |
| 167 | System.arraycopy(buffer, 4, unwrapped, 0, length - 4); |
| 168 | return unwrapped; |
| 169 | } |
| 170 | }); |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Helper to wrap a buffer, pretending the sasl client simply prepends the |
no test coverage detected